Commit d8725a97 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

Поправила перемещение по словам с зажатым shift ( ctr + shift + стрелка) :

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56977 954022d7-b5bf-4e40-9824-e11837661b57
parent bc4bd529
......@@ -75,7 +75,6 @@ function ParaMath()
g_oTableId.Add( this, this.Id );
}
var BFIRST = true;
ParaMath.prototype =
{
......@@ -1367,44 +1366,29 @@ ParaMath.prototype =
{
// TODO: ParaMath.Get_LeftPos
var result = this.Root.Get_LeftPos(SearchPos, ContentPos, Depth, UseContentPos, false);
/*var str = "";
for(var i = 0; i < SearchPos.Pos.Data.length; i++)
{
str += SearchPos.Pos.Data[i] + " ";
}
console.log(str);*/
BFIRST = false;
return result;
return this.Root.Get_LeftPos(SearchPos, ContentPos, Depth, UseContentPos, false);
},
Get_RightPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
// TODO: ParaMath.Get_RightPos
var result = this.Root.Get_RightPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false);
return this.Root.Get_RightPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false);
},
var str = "";
Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
{
// TODO: ParaMath.Get_StartEndPos
this.Root.Get_WordStartPos(SearchPos, ContentPos, Depth, UseContentPos, false);
/*var str = "";
for(var i = 0; i < SearchPos.Pos.Data.length; i++)
{
str += SearchPos.Pos.Data[i] + " ";
}
console.log(str);
return result;
},
Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
{
// TODO: ParaMath.Get_StartEndPos
this.Root.Get_WordStartPos(SearchPos, ContentPos, Depth, UseContentPos, false);
console.log(str);*/
},
Get_WordEndPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
......
......@@ -19,9 +19,6 @@ function CMathBase()
this.CurPos_X = 0;
this.CurPos_Y = 0;
//this.SelectStart_X = 0;
//this.SelectStart_Y = 0;
this.SelectStart =
{
X: 0,
......@@ -36,9 +33,6 @@ function CMathBase()
bOutside: false
};
//this.SelectEnd_X = 0;
//this.SelectEnd_Y = 0;
this.bSelectionUse = false;
this.nRow = 0;
......@@ -1506,7 +1500,6 @@ CMathBase.prototype =
Get_LeftPos: function(SearchPos, ContentPos, Depth, UseContentPos, EndRun)
{
var CurPos_X, CurPos_Y;
var result = false;
if(UseContentPos === true)
{
......@@ -1556,14 +1549,11 @@ CMathBase.prototype =
}
result = SearchPos.Found;
return result;
return SearchPos.Found;
},
Get_RightPos: function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, BegRun)
{
var CurPos_X, CurPos_Y;
var result = false;
if(UseContentPos === true)
{
......@@ -1612,14 +1602,12 @@ CMathBase.prototype =
}
result = SearchPos.Found;
var str = "Start: Outside " + this.SelectStart.bOutside + ", X " + this.SelectStart.X + ", Y " + this.SelectStart.Y + " ; " + "End: Outside " + this.SelectEnd.bOutside + ", X " + this.SelectEnd.X + ", Y " + this.SelectEnd.Y;
console.log(str);
/*var str = "Start: Outside " + this.SelectStart.bOutside + ", X " + this.SelectStart.X + ", Y " + this.SelectStart.Y + " ; " + "End: Outside " + this.SelectEnd.bOutside + ", X " + this.SelectEnd.X + ", Y " + this.SelectEnd.Y;
console.log(str);*/
return result;
return SearchPos.Found;
},
old_Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
Get_WordStartPos: function(SearchPos, ContentPos, Depth, UseContentPos, EndRun)
{
var CurPos_X, CurPos_Y;
......@@ -1628,50 +1616,10 @@ CMathBase.prototype =
CurPos_X = ContentPos.Get(Depth);
CurPos_Y = ContentPos.Get(Depth + 1);
}
else
{
CurPos_X = this.nRow - 1;
CurPos_Y = this.nCol - 1;
}
this.elements[CurPos_X][CurPos_Y].Get_WordStartPos(SearchPos, ContentPos, Depth + 2, UseContentPos);
while(CurPos_X >= 0)
{
var bJDraw = this.elements[CurPos_X][CurPos_Y].IsJustDraw(),
usePlh = !bJDraw && UseContentPos && this.elements[CurPos_X][CurPos_Y].IsPlaceholder(); // при первом проходе на плейсхолдере Get_WordStartPos не произойдет (если UseContentPos = true)
// на втором проходе UseContentPos = false
if(!bJDraw && !usePlh)
{
this.elements[CurPos_X][CurPos_Y].Get_WordStartPos(SearchPos, ContentPos, Depth + 2, UseContentPos);
SearchPos.Pos.Update(CurPos_X, Depth);
SearchPos.Pos.Update(CurPos_Y, Depth+1);
}
if(SearchPos.Found === true)
break;
UseContentPos = false;
CurPos_Y--;
if(CurPos_Y < 0)
{
CurPos_X--;
CurPos_Y = this.nCol - 1;
}
}
},
Get_WordStartPos: function(SearchPos, ContentPos, Depth, UseContentPos, EndRun)
{
var CurPos_X, CurPos_Y;
if(UseContentPos === true)
else if(SearchPos.ForSelection == true && this.SelectEnd.bOutside === true)
{
CurPos_X = ContentPos.Get(Depth);
CurPos_Y = ContentPos.Get(Depth + 1);
CurPos_X = this.SelectEnd.X;
CurPos_Y = this.SelectEnd.Y;
}
else
{
......@@ -1704,7 +1652,7 @@ CMathBase.prototype =
EndRun = true;
}
if(SearchPos.Found === true)
if(SearchPos.Found === true || SearchPos.ForSelection == true)
break;
CurPos_X--;
......@@ -1721,6 +1669,11 @@ CMathBase.prototype =
CurPos_X = ContentPos.Get(Depth);
CurPos_Y = ContentPos.Get(Depth + 1);
}
else if(SearchPos.ForSelection == true && this.SelectEnd.bOutside === true)
{
CurPos_X = this.SelectEnd.X;
CurPos_Y = this.SelectEnd.Y;
}
else
{
CurPos_X = 0;
......@@ -1752,7 +1705,7 @@ CMathBase.prototype =
BegRun = true;
}
if(SearchPos.Found === true)
if(SearchPos.Found === true || SearchPos.ForSelection == true)
break;
CurPos_X++;
......@@ -1861,25 +1814,13 @@ CMathBase.prototype =
},
SetSelectAll: function()
{
/*this.SelectStart_X = -1;
this.SelectStart_Y = -1;*/
this.SelectStart.bOutside = true;
this.SelectEnd.bOutside = true;
this.bSelectionUse = true;
/*this.SelectEnd_X = this.nRow - 1;
this.SelectEnd_Y = this.nCol - 1;*/
},
SelectToParent: function()
{
/*this.SelectStart.bOutside = true;
this.SelectEnd.bOutside = true;
this.bSelectionUse = true;*/
this.bSelectionUse = true;
this.Parent.SelectToParent();
},
......
......@@ -6384,10 +6384,8 @@ CMathContent.prototype =
////////////////////
Get_LeftPos: function(SearchPos, ContentPos, Depth, UseContentPos, EndRun)
{
var result = false;
var CurPos = UseContentPos ? ContentPos.Get(Depth) : this.content.length-1;
while(CurPos >= 0 && SearchPos.Found == false)
{
var curType = this.content[CurPos].typeObj,
......@@ -6404,8 +6402,6 @@ CMathContent.prototype =
var bNotshift = SearchPos.ForSelection == false,
bShiftCurrObj = (SearchPos.ForSelection == true && this.SelectStartPos == CurPos);
//console.log("Get_LeftPos : CurPos " + CurPos + " SelectStartPos " + this.SelectStartPos);
if( bNotshift || bShiftCurrObj )
this.content[CurPos].Get_LeftPos(SearchPos, ContentPos, Depth + 1, UseContentPos, EndRun);
}
......@@ -6422,29 +6418,23 @@ CMathContent.prototype =
SearchPos.Pos.Update(CurPos, Depth);
if(curType == MATH_PARA_RUN && prevType == MATH_PARA_RUN)
EndRun = false;
else
EndRun = true;
// если перемещаемся между контентами мат объекта, то надо выставить курсор в конец следующего контента, в конечную позицию последнего рана
EndRun = (curType == MATH_PARA_RUN && prevType == MATH_PARA_RUN) ? false : true;
CurPos--;
UseContentPos = false;
}
result = SearchPos.Found;
/// для коррекции позиции курсора в начале Run
// используется функция Correct_ContentPos в Paragraph
return result;
return SearchPos.Found;
},
Get_RightPos: function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, BegRun)
{
var result = false;
var CurPos = UseContentPos ? ContentPos.Get(Depth) : 0;
while(CurPos < this.content.length && SearchPos.Found == false)
{
var curType = this.content[CurPos].typeObj,
......@@ -6475,71 +6465,20 @@ CMathContent.prototype =
SearchPos.Pos.Update(CurPos, Depth);
// если перемещаемся между контентами мат объекта, то надо выставить курсор в начало следующего контента, в начальную позицию первого рана
BegRun = (curType == MATH_PARA_RUN && nextType == MATH_PARA_RUN) ? false : true;
if(curType == MATH_PARA_RUN && nextType == MATH_PARA_RUN)
BegRun = false;
else
BegRun = true;
CurPos++;
UseContentPos = false;
}
result = SearchPos.Found;
return result;
},
old_Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
{
var CurPos = ( true === UseContentPos ? ContentPos.Get(Depth) : this.content.length - 1 );
//this.content[CurPos].Get_WordStartPos(SearchPos, ContentPos, Depth + 1, UseContentPos);
//CurPos--;
//if ( true === SearchPos.UpdatePos )
// SearchPos.Pos.Update( CurPos, Depth );
var bFirst = true;
while(CurPos >= 0 && SearchPos.Found == false)
{
var item = this.content[CurPos];
SearchPos.Pos.Update(CurPos, Depth);
if(item.typeObj == MATH_PLACEHOLDER)
{
SearchPos.UpdatePos = true;
SearchPos.Found = true;
break;
}
else if(item.typeObj == MATH_COMP)
{
SearchPos.UpdatePos = true;
SearchPos.Found = true;
break;
}
else if(item.typeObj == MATH_PARA_RUN)
{
item.Get_WordStartPos(SearchPos, ContentPos, Depth + 1, UseContentPos);
if(true === SearchPos.UpdatePos)
break;
}
CurPos--;
}
return SearchPos.Found;
},
Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos, EndRun)
{
var CurPos = UseContentPos ? ContentPos.Get(Depth) : this.content.length-1;
var bUseContent = UseContentPos;
while(CurPos >= 0 && SearchPos.Found == false)
{
var curType = this.content[CurPos].typeObj,
......@@ -6553,7 +6492,11 @@ CMathContent.prototype =
}
else if(curType == MATH_COMP)
{
this.content[CurPos].Get_WordStartPos(SearchPos, ContentPos, Depth + 1, bUseContent, EndRun);
var bNotshift = SearchPos.ForSelection == false,
bShiftCurrObj = (SearchPos.ForSelection == true && this.SelectStartPos == CurPos);
if( bNotshift || bShiftCurrObj )
this.content[CurPos].Get_WordStartPos(SearchPos, ContentPos, Depth + 1, UseContentPos, EndRun);
}
else if(EndRun)
{
......@@ -6562,7 +6505,7 @@ CMathContent.prototype =
}
else
{
this.content[CurPos].Get_WordStartPos(SearchPos, ContentPos, Depth + 1, bUseContent);
this.content[CurPos].Get_WordStartPos(SearchPos, ContentPos, Depth + 1, UseContentPos);
if(SearchPos.Found == false && SearchPos.Shift == true)
{
......@@ -6573,14 +6516,12 @@ CMathContent.prototype =
SearchPos.Pos.Update(CurPos, Depth);
// если перемещаемся между контентами мат объекта, то надо выставить курсор в конец следующего контента, в конечную позицию последнего рана
EndRun = (curType == MATH_PARA_RUN && prevType == MATH_PARA_RUN) ? false : true;
if(curType == MATH_PARA_RUN && prevType == MATH_PARA_RUN)
EndRun = false;
else
EndRun = true;
CurPos--;
bUseContent = false;
UseContentPos = false;
}
},
......@@ -6588,8 +6529,6 @@ CMathContent.prototype =
{
var CurPos = UseContentPos ? ContentPos.Get(Depth) : 0;
var bUseContent = UseContentPos;
while(CurPos < this.content.length && SearchPos.Found == false)
{
var curType = this.content[CurPos].typeObj,
......@@ -6602,7 +6541,11 @@ CMathContent.prototype =
}
else if(curType == MATH_COMP)
{
this.content[CurPos].Get_WordEndPos(SearchPos, ContentPos, Depth + 1, bUseContent, StepEnd, BegRun);
var bNotshift = SearchPos.ForSelection == false,
bShiftCurrObj = SearchPos.ForSelection == true && this.SelectStartPos == CurPos;
if( bNotshift || bShiftCurrObj )
this.content[CurPos].Get_WordEndPos(SearchPos, ContentPos, Depth + 1, UseContentPos, StepEnd, BegRun);
}
else if(BegRun)
{
......@@ -6611,7 +6554,7 @@ CMathContent.prototype =
}
else
{
this.content[CurPos].Get_WordEndPos(SearchPos, ContentPos, Depth + 1, bUseContent, StepEnd);
this.content[CurPos].Get_WordEndPos(SearchPos, ContentPos, Depth + 1, UseContentPos, StepEnd);
if(SearchPos.Found == false && SearchPos.Shift == true)
{
......@@ -6622,14 +6565,12 @@ CMathContent.prototype =
SearchPos.Pos.Update(CurPos, Depth);
// если перемещаемся между контентами мат объекта, то надо выставить курсор в начало следующего контента, в начальную позицию первого рана
BegRun = (curType == MATH_PARA_RUN && nextType == MATH_PARA_RUN) ? false : true;
if(curType == MATH_PARA_RUN && nextType == MATH_PARA_RUN)
BegRun = false;
else
BegRun = true;
CurPos++;
bUseContent = false;
UseContentPos = false;
}
},
......@@ -6685,14 +6626,10 @@ CMathContent.prototype =
{
var element;
if(this.content[i].typeObj == MATH_PARA_RUN)
{
element = this.content[i].Copy(Selected);
}
else
{
element = this.content[i].Copy(false);
//element.relate(this);
}
NewContent.content.push(element);
}
......
......@@ -182,11 +182,6 @@ CGlyphOperator.prototype.draw_other = function() // с выравнивание
YY[i] = y + X[i]*a2 + Y[i]*b2 + c2 + gpY;
}
for(var i = 0; i < YY.length; i++)
{
console.log("YY["+ i + "] = "+ YY[i]);
}
var intGrid = MathControl.pGraph.GetIntegerGrid();
MathControl.pGraph.SetIntegerGrid(false);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment