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

1. Поправила селект

2. Реализовала SelectToParent для селекта мат объекта из внутреннего контента (плейсхолдер и т.п.)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56872 954022d7-b5bf-4e40-9824-e11837661b57
parent a9e294ef
...@@ -94,10 +94,12 @@ ParaMath.prototype = ...@@ -94,10 +94,12 @@ ParaMath.prototype =
{ {
var result = this.GetSelectContent(); var result = this.GetSelectContent();
NewMath.Root = result.Content.Copy(Selected); NewMath.Root = result.Content.Copy(Selected);
NewMath.Root.bRoot = true;
} }
else else
{ {
NewMath.Root = this.Root.Copy(Selected); NewMath.Root = this.Root.Copy(Selected);
NewMath.Root.bRoot = true;
} }
/// argSize, bDot и bRoot выставить на объединении контентов /// argSize, bDot и bRoot выставить на объединении контентов
...@@ -223,6 +225,14 @@ ParaMath.prototype = ...@@ -223,6 +225,14 @@ ParaMath.prototype =
Remove : function(Direction, bOnAddText) Remove : function(Direction, bOnAddText)
{ {
var oContent = this.GetSelectContent(); var oContent = this.GetSelectContent();
/*var Comp = oContent.Content.GetParent();
Comp.SetSelectAll();
Comp.SelectToParent();
this.bSelectionUse = true;*/
if (oContent.Start == oContent.End) if (oContent.Start == oContent.End)
{ {
var oElem = oContent.Content.getElem(oContent.Start); var oElem = oContent.Content.getElem(oContent.Start);
...@@ -445,7 +455,6 @@ ParaMath.prototype = ...@@ -445,7 +455,6 @@ ParaMath.prototype =
this.Root.Resize(null, this, g_oTextMeasurer, TextPr); this.Root.Resize(null, this, g_oTextMeasurer, TextPr);
BFIRST = false;
var pos = new CMathPosition(); var pos = new CMathPosition();
pos.x = 0; pos.x = 0;
...@@ -1149,6 +1158,8 @@ ParaMath.prototype = ...@@ -1149,6 +1158,8 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Cursor_MoveToStartPos // TODO: ParaMath.Cursor_MoveToStartPos
//console.log("Cursor_MoveToStartPos");
this.Root.Cursor_MoveToStartPos(); this.Root.Cursor_MoveToStartPos();
}, },
...@@ -1296,14 +1307,38 @@ ParaMath.prototype = ...@@ -1296,14 +1307,38 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Get_LeftPos // TODO: ParaMath.Get_LeftPos
return this.Root.Get_LeftPos(SearchPos, ContentPos, Depth, UseContentPos, false); 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;
}, },
Get_RightPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd) Get_RightPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{ {
// TODO: ParaMath.Get_RightPos // TODO: ParaMath.Get_RightPos
return this.Root.Get_RightPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false); var result = this.Root.Get_RightPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, 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) Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
...@@ -1351,7 +1386,17 @@ ParaMath.prototype = ...@@ -1351,7 +1386,17 @@ ParaMath.prototype =
Get_StartPos : function(ContentPos, Depth) Get_StartPos : function(ContentPos, Depth)
{ {
// TODO: ParaMath.Get_StartPos // TODO: ParaMath.Get_StartPos
this.Root.Get_StartPos(ContentPos, Depth); this.Root.Get_StartPos(ContentPos, Depth);
/*var str = "";
for(var i = 0 ; i < ContentPos.Data.length; i++)
{
}*/
//console.log("Get_StartPos");
}, },
Get_EndPos : function(BehindEnd, ContentPos, Depth) Get_EndPos : function(BehindEnd, ContentPos, Depth)
...@@ -1366,6 +1411,8 @@ ParaMath.prototype = ...@@ -1366,6 +1411,8 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Set_SelectionContentPos // TODO: ParaMath.Set_SelectionContentPos
//console.log(" Set_SelectionContentPos " );
this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag); this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
this.bSelectionUse = true; this.bSelectionUse = true;
}, },
......
This diff is collapsed.
...@@ -5869,6 +5869,10 @@ CMathContent.prototype = ...@@ -5869,6 +5869,10 @@ CMathContent.prototype =
this.content[i].Recalculate_Reset(StartRange, StartLine); this.content[i].Recalculate_Reset(StartRange, StartLine);
} }
}, },
GetParent: function()
{
return this.Parent.GetParent();
},
// Поиск позиции, селект // Поиск позиции, селект
...@@ -6021,6 +6025,14 @@ CMathContent.prototype = ...@@ -6021,6 +6025,14 @@ CMathContent.prototype =
return result; return result;
}, },
SelectToParent : function()
{
this.bSelectionUse = true;
if(!this.bRoot)
this.Parent.SelectToParent();
},
/////////////////////// ///////////////////////
...@@ -6369,7 +6381,6 @@ CMathContent.prototype = ...@@ -6369,7 +6381,6 @@ CMathContent.prototype =
var result = false; var result = false;
var CurPos = UseContentPos ? ContentPos.Get(Depth) : this.content.length-1; var CurPos = UseContentPos ? ContentPos.Get(Depth) : this.content.length-1;
var bUseContent = UseContentPos;
while(CurPos >= 0 && SearchPos.Found == false) while(CurPos >= 0 && SearchPos.Found == false)
{ {
...@@ -6384,7 +6395,13 @@ CMathContent.prototype = ...@@ -6384,7 +6395,13 @@ CMathContent.prototype =
} }
else if(curType == MATH_COMP) else if(curType == MATH_COMP)
{ {
this.content[CurPos].Get_LeftPos(SearchPos, ContentPos, Depth + 1, bUseContent, EndRun); 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);
} }
else if(EndRun) else if(EndRun)
{ {
...@@ -6393,7 +6410,7 @@ CMathContent.prototype = ...@@ -6393,7 +6410,7 @@ CMathContent.prototype =
} }
else else
{ {
this.content[CurPos].Get_LeftPos(SearchPos, ContentPos, Depth + 1, bUseContent); this.content[CurPos].Get_LeftPos(SearchPos, ContentPos, Depth + 1, UseContentPos);
} }
SearchPos.Pos.Update(CurPos, Depth); SearchPos.Pos.Update(CurPos, Depth);
...@@ -6405,7 +6422,7 @@ CMathContent.prototype = ...@@ -6405,7 +6422,7 @@ CMathContent.prototype =
EndRun = true; EndRun = true;
CurPos--; CurPos--;
bUseContent = false; UseContentPos = false;
} }
result = SearchPos.Found; result = SearchPos.Found;
...@@ -6435,6 +6452,12 @@ CMathContent.prototype = ...@@ -6435,6 +6452,12 @@ CMathContent.prototype =
} }
else if(curType == MATH_COMP) else if(curType == MATH_COMP)
{ {
var bNotshift = SearchPos.ForSelection == false,
bShiftCurrObj = SearchPos.ForSelection == true && this.SelectStartPos == CurPos;
//console.log("Get_RightPos : CurPos " + CurPos + " SelectStartPos " + this.SelectStartPos);
if( bNotshift || bShiftCurrObj )
this.content[CurPos].Get_RightPos(SearchPos, ContentPos, Depth + 1, bUseContent, StepEnd, BegRun); this.content[CurPos].Get_RightPos(SearchPos, ContentPos, Depth + 1, bUseContent, StepEnd, BegRun);
} }
else if(BegRun) else if(BegRun)
...@@ -6710,7 +6733,7 @@ CMathContent.prototype = ...@@ -6710,7 +6733,7 @@ CMathContent.prototype =
this.content[this.CurPos + 1].SetSelectAll(); this.content[this.CurPos + 1].SetSelectAll();
} }
} }
else if(this.content[this.CurPos].typeObj == MATH_COMP ) else if(this.content[this.CurPos].typeObj == MATH_COMP)
{ {
if(this.content[this.CurPos].IsCurrentPlh()) if(this.content[this.CurPos].IsCurrentPlh())
{ {
......
...@@ -1015,10 +1015,6 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1015,10 +1015,6 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
} }
//var base, degr;
var shTop,
height, width, ascent;
if(this.RecalcInfo.bProps) if(this.RecalcInfo.bProps)
{ {
if(this.Pr.degHide == true) if(this.Pr.degHide == true)
...@@ -1064,7 +1060,8 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure) ...@@ -1064,7 +1060,8 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.Iterator.Resize(this, ParaMath, oMeasure); this.Iterator.Resize(this, ParaMath, oMeasure);
this.RealBase.Resize(this, ParaMath, oMeasure); this.RealBase.Resize(this, ParaMath, oMeasure);
} }
var shTop,
height, width, ascent;
this.signRadical.recalculateSize(oMeasure, this.RealBase.size); this.signRadical.recalculateSize(oMeasure, this.RealBase.size);
......
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