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

1. Перенесла ф-ию setPosition из Draw_Elements в Recalculate_Range_Spaces, так...

1. Перенесла ф-ию setPosition из Draw_Elements в Recalculate_Range_Spaces, так как поиск позиции Get_ParaContentPosByXY (на котором запрашивается позиция конкретной строки), может прийти раньше, чем отрисовка (документ полностью не загрузился, не отрисовался, пересчиталась часть формул, поэтому на PageDown, скролле может прийти поиск позиции для формул, которые еще не были отрисованы)
2. Переделала ф-ии Get_ParaPosByContentPos (возникала ошибка при нажатии клавиши End в формуле)
3. Клавиши Home, End не работали: переделала работу функций Get_StartRangePos, Get_EndRangePos, Get_StartRangePos2
4. Передалала алгоритм работы Home, End
5. Поправила баг : если после многострочной не inline формулы добавляли текст, то не вызывалась ф-ия PreRecalc(могло  получиться так, что пересчет для первой строки не приходил), из-за этого некорректно рассчитывались позиции и размеры букв

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@61368 954022d7-b5bf-4e40-9824-e11837661b57
parent e2fb23e6
...@@ -463,7 +463,6 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, Page, _X, _XL ...@@ -463,7 +463,6 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, Page, _X, _XL
else else
W = MaxW; W = MaxW;
if(this.Root.IsFirstLine(_CurLine)) if(this.Root.IsFirstLine(_CurLine))
{ {
switch(Jc) switch(Jc)
...@@ -845,10 +844,6 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -845,10 +844,6 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var RecalCurrentMath = PRS.PrevLineRecalcInfo.Object == null || PRS.PrevLineRecalcInfo.Object == this; var RecalCurrentMath = PRS.PrevLineRecalcInfo.Object == null || PRS.PrevLineRecalcInfo.Object == this;
var bFirstLine = this.Root.IsFirstLine(ParaLine); var bFirstLine = this.Root.IsFirstLine(ParaLine);
var RecalcResult = PRS.RecalcResult,
RecalcInfoObject = PRS.PrevLineRecalcInfo.Object;
var MathSettings = Get_WordDocumentDefaultMathSettings(); var MathSettings = Get_WordDocumentDefaultMathSettings();
// первый пересчет // первый пересчет
...@@ -862,16 +857,21 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -862,16 +857,21 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.FirstPage = Page; this.FirstPage = Page;
this.CurPageInfo.Page = -1; this.CurPageInfo.Page = -1;
this.LinesWidths.length = 0; this.LinesWidths.length = 0;
}
// информация о пересчете // пока будем каждый раз обновлять информацию (т.к. когда не inline формула становиться inline может получиться так, что пересчет для первой строки не придет)
var RPI = new CRPI(); // когда пересчет всегда будет приходить для первой строки, эта часть будет выполняться только при первом пересчете первой строки
RPI.MergeMathInfo(this.ParaMathRPI);
var ArgSize = new CMathArgSize();
this.Root.Set_Paragraph(Para); // информация о пересчете
this.Root.Set_ParaMath(this, null); var RPI = new CRPI();
this.Root.PreRecalc(null, this, ArgSize, RPI); RPI.MergeMathInfo(this.ParaMathRPI);
} var ArgSize = new CMathArgSize();
this.Root.Set_Paragraph(Para);
this.Root.Set_ParaMath(this, null);
this.Root.PreRecalc(null, this, ArgSize, RPI);
////////////////////////////////////////////////////////////
var CurrentPage = Page - this.FirstPage; var CurrentPage = Page - this.FirstPage;
...@@ -965,10 +965,28 @@ ParaMath.prototype.UpdateWidthLine = function(PRS, Width) ...@@ -965,10 +965,28 @@ ParaMath.prototype.UpdateWidthLine = function(PRS, Width)
}; };
ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, _CurPage) ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, _CurPage)
{ {
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.Root.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange ); var CurRange = ( 0 === CurLine ? _CurRange - this.Root.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange); var Pos = new CMathPosition();
Pos.x = PRSA.X;
Pos.y = PRSA.Y;
this.LinesPositions[CurLine] = Pos;
var pos = new CMathPosition();
this.Root.setPosition(pos, _CurLine, _CurRange);
this.Root.Recalculate_Range_Spaces(PRSA, _CurLine, _CurRange, _CurPage);
/*
// Позиция в документе для формулы
//this.Math.absPos = {x: PRSA.X, y: PRSA.Y - this.Root.size.ascent};
this.X = PRSA.X;
this.Y = PRSA.Y - this.Root.size.ascent;
*/
/*var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange); var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (EndPos >= 1) if (EndPos >= 1)
...@@ -981,14 +999,11 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange ...@@ -981,14 +999,11 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
else else
this.WidthVisible = this.Width + PRSA.JustifyWord; this.WidthVisible = this.Width + PRSA.JustifyWord;
// Позиция в документе для формулы
//this.Math.absPos = {x: PRSA.X, y: PRSA.Y - this.Root.size.ascent};
this.X = PRSA.X;
this.Y = PRSA.Y - this.Root.size.ascent;
PRSA.X += this.WidthVisible; PRSA.X += this.WidthVisible;
PRSA.LastW = this.WidthVisible; PRSA.LastW = this.WidthVisible;
} }*/
}; };
ParaMath.prototype.Recalculate_PageEndInfo = function(PRSI, _CurLine, _CurRange) ParaMath.prototype.Recalculate_PageEndInfo = function(PRSI, _CurLine, _CurRange)
{ {
...@@ -1040,31 +1055,10 @@ ParaMath.prototype.Check_BreakPageEnd = function(PBChecker) ...@@ -1040,31 +1055,10 @@ ParaMath.prototype.Check_BreakPageEnd = function(PBChecker)
{ {
return true; return true;
}; };
ParaMath.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth) ParaMath.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth)
{ {
var Pos = ContentPos.Get(Depth); return this.Root.Get_ParaPosByContentPos(ContentPos, Depth);
var CurLine = 0;
var CurRange = 0;
var LinesCount = this.protected_GetLinesCount();
for ( ; CurLine < LinesCount; CurLine++ )
{
var RangesCount = this.protected_GetRangesCount(CurLine);
for ( CurRange = 0; CurRange < RangesCount; CurRange++ )
{
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (Pos < EndPos && Pos >= StartPos)
return new CParaPos((CurLine === 0 ? CurRange + this.StartRange : CurRange), CurLine + this.StartLine, 0, 0);
}
}
return new CParaPos((LinesCount === 1 ? this.protected_GetRangesCount(0) - 1 + this.StartRange : this.protected_GetRangesCount(0) - 1), LinesCount - 1 + this.StartLine, 0, 0);
}; };
ParaMath.prototype.old_Recalculate_CurPos = function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget) ParaMath.prototype.old_Recalculate_CurPos = function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{ {
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.StartLine;
...@@ -1520,17 +1514,6 @@ ParaMath.prototype.Draw_Elements = function(PDSE) ...@@ -1520,17 +1514,6 @@ ParaMath.prototype.Draw_Elements = function(PDSE)
/*PDSE.Graphics.p_color(255,0,0, 255); /*PDSE.Graphics.p_color(255,0,0, 255);
PDSE.Graphics.drawHorLine(0, PDSE.Y - this.Ascent, PDSE.X - 30, PDSE.X + this.Width + 30 , 1);*/ PDSE.Graphics.drawHorLine(0, PDSE.Y - this.Ascent, PDSE.X - 30, PDSE.X + this.Width + 30 , 1);*/
var CurLine = PDSE.Line - this.Root.StartLine;
var Pos = new CMathPosition();
Pos.x = PDSE.X;
Pos.y = PDSE.Y;
this.LinesPositions[CurLine] = Pos;
var pos = new CMathPosition();
this.Root.setPosition(pos, PDSE);
this.Root.Draw_Elements(PDSE); this.Root.Draw_Elements(PDSE);
...@@ -1744,55 +1727,18 @@ ParaMath.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseCo ...@@ -1744,55 +1727,18 @@ ParaMath.prototype.Get_WordEndPos = function(SearchPos, ContentPos, Depth, UseCo
{ {
this.Root.Get_WordEndPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false); this.Root.Get_WordEndPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd, false);
}; };
ParaMath.prototype.Get_EndRangePos = function(_CurLine, _CurRange, SearchPos, Depth) ParaMath.prototype.Get_EndRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{ {
var CurLine = _CurLine - this.StartLine; return this.Root.Get_EndRangePos(_CurLine, _CurRange, SearchPos, Depth);
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (EndPos >= 1)
{
// TODO: ParaMath.Get_EndRangePos Сделать для случая, когда формула будет занимать несколько строк
this.Root.Get_EndPos(false, SearchPos.Pos, Depth);
return true;
}
return false;
}; };
ParaMath.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth) ParaMath.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{ {
var CurLine = _CurLine - this.StartLine; return this.Root.Get_StartRangePos(_CurLine, _CurRange, SearchPos, Depth);
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (EndPos >= 1)
{
// TODO: ParaMath.Get_StartRangePos Сделать для случая, когда формула будет занимать несколько строк
this.Root.Get_StartPos(SearchPos.Pos, Depth);
return true;
}
return false;
}; };
ParaMath.prototype.Get_StartRangePos2 = function(_CurLine, _CurRange, ContentPos, Depth) ParaMath.prototype.Get_StartRangePos2 = function(_CurLine, _CurRange, ContentPos, Depth)
{ {
var CurLine = _CurLine - this.StartLine; return this.Root.Get_StartRangePos(_CurLine, _CurRange, SearchPos, Depth);
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange ); };
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (EndPos >= 1)
{
// TODO: ParaMath.Get_StartRangePos2 Сделать для случая, когда формула будет занимать несколько строк
return this.Root.Get_StartPos(ContentPos, Depth);
}
return false;};
ParaMath.prototype.Get_StartPos = function(ContentPos, Depth) ParaMath.prototype.Get_StartPos = function(ContentPos, Depth)
{ {
......
...@@ -946,7 +946,9 @@ ParaRun.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth) ...@@ -946,7 +946,9 @@ ParaRun.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth)
{ {
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange); var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange); var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if (Pos < EndPos && Pos >= StartPos)
var bUpdateMathRun = Pos == EndPos && StartPos == EndPos && EndPos == this.Content.length && this.Type == para_Math_Run; // для para_Run позиция может быть после последнего элемента (пример: Run, за ним идет мат объект)
if (Pos < EndPos && Pos >= StartPos || bUpdateMathRun)
return new CParaPos((CurLine === 0 ? CurRange + this.StartRange : CurRange), CurLine + this.StartLine, 0, 0); return new CParaPos((CurLine === 0 ? CurRange + this.StartRange : CurRange), CurLine + this.StartLine, 0, 0);
} }
} }
...@@ -990,7 +992,7 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu ...@@ -990,7 +992,7 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu
X += loc.x; X += loc.x;
Y += loc.y; Y += loc.y;
} }
else else if(!(StartPos == EndPos)) // исключаем этот случай StartPos == EndPos && EndPos == Pos, это возможно когда конец Run находится в начале строки, при этом ни одна из букв этого Run не входит в эту строку
{ {
var Letter = this.Content[Pos - 1]; var Letter = this.Content[Pos - 1];
loc = Letter.GetLocationOfLetter(); loc = Letter.GetLocationOfLetter();
...@@ -2814,6 +2816,8 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, ...@@ -2814,6 +2816,8 @@ ParaRun.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange,
{ {
case para_Sym: case para_Sym:
case para_Text: case para_Text:
case para_Math_Text:
case para_Math_BreakOperator:
{ {
var WidthVisible = 0; var WidthVisible = 0;
...@@ -3145,7 +3149,6 @@ ParaRun.prototype.Refresh_RecalcData = function(Data) ...@@ -3145,7 +3149,6 @@ ParaRun.prototype.Refresh_RecalcData = function(Data)
Para.Refresh_RecalcData2(0); Para.Refresh_RecalcData2(0);
} }
}; };
ParaRun.prototype.Save_RecalculateObject = function(Copy) ParaRun.prototype.Save_RecalculateObject = function(Copy)
{ {
var RecalcObj = new CRunRecalculateObject(this.StartLine, this.StartRange); var RecalcObj = new CRunRecalculateObject(this.StartLine, this.StartRange);
...@@ -3153,13 +3156,11 @@ ParaRun.prototype.Save_RecalculateObject = function(Copy) ...@@ -3153,13 +3156,11 @@ ParaRun.prototype.Save_RecalculateObject = function(Copy)
RecalcObj.Save_RunContent( this, Copy ); RecalcObj.Save_RunContent( this, Copy );
return RecalcObj; return RecalcObj;
}; };
ParaRun.prototype.Load_RecalculateObject = function(RecalcObj) ParaRun.prototype.Load_RecalculateObject = function(RecalcObj)
{ {
RecalcObj.Load_Lines(this); RecalcObj.Load_Lines(this);
RecalcObj.Load_RunContent(this); RecalcObj.Load_RunContent(this);
}; };
ParaRun.prototype.Prepare_RecalculateObject = function() ParaRun.prototype.Prepare_RecalculateObject = function()
{ {
this.protected_ClearLines(); this.protected_ClearLines();
...@@ -3174,7 +3175,6 @@ ParaRun.prototype.Prepare_RecalculateObject = function() ...@@ -3174,7 +3175,6 @@ ParaRun.prototype.Prepare_RecalculateObject = function()
Item.Prepare_RecalculateObject(); Item.Prepare_RecalculateObject();
} }
}; };
ParaRun.prototype.Is_EmptyRange = function(_CurLine, _CurRange) ParaRun.prototype.Is_EmptyRange = function(_CurLine, _CurRange)
{ {
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.StartLine;
...@@ -3188,7 +3188,6 @@ ParaRun.prototype.Is_EmptyRange = function(_CurLine, _CurRange) ...@@ -3188,7 +3188,6 @@ ParaRun.prototype.Is_EmptyRange = function(_CurLine, _CurRange)
return false; return false;
}; };
ParaRun.prototype.Check_Range_OnlyMath = function(Checker, _CurRange, _CurLine) ParaRun.prototype.Check_Range_OnlyMath = function(Checker, _CurRange, _CurLine)
{ {
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.StartLine;
...@@ -4688,11 +4687,6 @@ ParaRun.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, D ...@@ -4688,11 +4687,6 @@ ParaRun.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, D
SearchPos.Pos.Update( FirstPos, Depth ); SearchPos.Pos.Update( FirstPos, Depth );
return true; return true;
} }
else if(this.Type == para_Math_Run && this.Parent.Is_FirstComposition())
{
SearchPos.Pos.Update( 0, Depth );
return true;
}
else else
return false; return false;
}; };
...@@ -8353,10 +8347,10 @@ function CRunCollaborativeRange(PosS, PosE, Color) ...@@ -8353,10 +8347,10 @@ function CRunCollaborativeRange(PosS, PosE, Color)
this.PosE = PosE; this.PosE = PosE;
this.Color = Color; this.Color = Color;
} }
ParaRun.prototype.Math_SetPosition = function(pos, PDSE) ParaRun.prototype.Math_SetPosition = function(pos, Line, Range)
{ {
var CurLine = PDSE.Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSE.Range - this.StartRange : PDSE.Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange); var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange); var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
...@@ -8367,11 +8361,6 @@ ParaRun.prototype.Math_SetPosition = function(pos, PDSE) ...@@ -8367,11 +8361,6 @@ ParaRun.prototype.Math_SetPosition = function(pos, PDSE)
for(var i = StartPos; i < EndPos; i++) for(var i = StartPos; i < EndPos; i++)
{ {
//var NewPos = new CMathPosition();
//NewPos.x = pos.x + w;
//NewPos.y = pos.y - this.size.ascent;
this.Content[i].setPosition(pos); this.Content[i].setPosition(pos);
pos.x += this.Content[i].size.width; pos.x += this.Content[i].size.width;
} }
...@@ -8502,6 +8491,48 @@ ParaRun.prototype.Math_GetWidth = function(_CurLine, _CurRange) ...@@ -8502,6 +8491,48 @@ ParaRun.prototype.Math_GetWidth = function(_CurLine, _CurRange)
return W; return W;
}; };
ParaRun.prototype.Math_Get_StartRangePos = function(bStartLine, _CurLine, _CurRange, SearchPos, Depth)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var Pos = this.State.ContentPos;
var Result = true;
if(bStartLine || StartPos < Pos)
{
SearchPos.Pos.Update(StartPos, Depth);
}
else
{
Result = false;
}
return Result;
};
ParaRun.prototype.Math_Get_EndRangePos = function(bEndLine, _CurLine, _CurRange, SearchPos, Depth)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var Pos = this.State.ContentPos;
var Result = true;
if(bEndLine || Pos < EndPos)
{
SearchPos.Pos.Update(EndPos, Depth);
}
else
{
Result = false;
}
return Result;
};
ParaRun.prototype.Recalculate_Range_OneLine = function(PRS, ParaPr, Depth) ParaRun.prototype.Recalculate_Range_OneLine = function(PRS, ParaPr, Depth)
{ {
// данная функция используется только для мат объектов, которые на строки не разбиваются // данная функция используется только для мат объектов, которые на строки не разбиваются
......
...@@ -467,7 +467,7 @@ CAccent.prototype.IsAccent = function() ...@@ -467,7 +467,7 @@ CAccent.prototype.IsAccent = function()
{ {
return true; return true;
}; };
CAccent.prototype.setPosition = function(pos, PDSE) CAccent.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent; this.pos.y = pos.y - this.size.ascent;
...@@ -490,7 +490,7 @@ CAccent.prototype.setPosition = function(pos, PDSE) ...@@ -490,7 +490,7 @@ CAccent.prototype.setPosition = function(pos, PDSE)
PosBase.x = this.pos.x + this.GapLeft + alignCnt; PosBase.x = this.pos.x + this.GapLeft + alignCnt;
PosBase.y = this.pos.y + this.operator.size.height + oBase.size.ascent; PosBase.y = this.pos.y + this.operator.size.height + oBase.size.ascent;
oBase.setPosition(PosBase, PDSE); oBase.setPosition(PosBase, Line, Range);
pos.x += this.size.width; pos.x += this.size.width;
}; };
......
...@@ -276,7 +276,7 @@ CMathBase.prototype.align = function(pos_x, pos_y) ...@@ -276,7 +276,7 @@ CMathBase.prototype.align = function(pos_x, pos_y)
return PosAlign; return PosAlign;
}; };
CMathBase.prototype.setPosition = function(pos, PDSE) CMathBase.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
...@@ -305,7 +305,7 @@ CMathBase.prototype.setPosition = function(pos, PDSE) ...@@ -305,7 +305,7 @@ CMathBase.prototype.setPosition = function(pos, PDSE)
if(this.elements[i][j].Type == para_Math_Content) // прибавим ascent только для контентов, для вложенных мат объектов не добавляем ! if(this.elements[i][j].Type == para_Math_Content) // прибавим ascent только для контентов, для вложенных мат объектов не добавляем !
NewPos.y += this.elements[i][j].size.ascent; NewPos.y += this.elements[i][j].size.ascent;
this.elements[i][j].setPosition(NewPos, PDSE); this.elements[i][j].setPosition(NewPos, Line, Range);
w += Widths[j]; w += Widths[j];
} }
h += Heights[i]; h += Heights[i];
...@@ -1002,8 +1002,35 @@ CMathBase.prototype.SelectToParent = function(bCorrect) ...@@ -1002,8 +1002,35 @@ CMathBase.prototype.SelectToParent = function(bCorrect)
this.bSelectionUse = true; this.bSelectionUse = true;
this.Parent.SelectToParent(bCorrect); this.Parent.SelectToParent(bCorrect);
}; };
CMathBase.prototype.Set_Paragraph = CParagraphContentWithParagraphLikeContent.prototype.Set_Paragraph; CMathBase.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
CMathBase.prototype.Get_ElementByPos = CParagraphContentWithParagraphLikeContent.prototype.Get_ElementByPos; {
var Result = this.Content[this.CurPos].Get_StartRangePos(_CurLine, _CurRange, SearchPos, Depth+1);
if ( true === Result )
SearchPos.Pos.Update( this.CurPos, Depth );
return Result;
};
CMathBase.prototype.Get_EndRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{
var Result = this.Content[this.CurPos].Get_EndRangePos(_CurLine, _CurRange, SearchPos, Depth+1);
if ( true === Result )
SearchPos.Pos.Update( this.CurPos, Depth );
return Result;
};
CMathBase.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange, _CurPage)
{
PRSA.X += this.size.width;
PRSA.LastW = this.size.width;
};
CMathBase.prototype.Set_Paragraph = CParagraphContentWithParagraphLikeContent.prototype.Set_Paragraph;
CMathBase.prototype.Get_ElementByPos = CParagraphContentWithParagraphLikeContent.prototype.Get_ElementByPos;
CMathBase.prototype.Get_ParaPosByContentPos = CParagraphContentWithParagraphLikeContent.prototype.Get_ParaPosByContentPos;
CMathBase.prototype.Set_ParaMath = CMathContent.prototype.Set_ParaMath; CMathBase.prototype.Set_ParaMath = CMathContent.prototype.Set_ParaMath;
CMathBase.prototype.Recalculate_Reset = function(StartRange, StartLine) CMathBase.prototype.Recalculate_Reset = function(StartRange, StartLine)
{ {
......
...@@ -359,7 +359,7 @@ CBorderBox.prototype.Draw_Elements = function(PDSE) ...@@ -359,7 +359,7 @@ CBorderBox.prototype.Draw_Elements = function(PDSE)
PDSE.X = _X + this.size.width; PDSE.X = _X + this.size.width;
} }
CBorderBox.prototype.setPosition = function(pos, PDSE) CBorderBox.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent; this.pos.y = pos.y - this.size.ascent;
...@@ -379,7 +379,7 @@ CBorderBox.prototype.setPosition = function(pos, PDSE) ...@@ -379,7 +379,7 @@ CBorderBox.prototype.setPosition = function(pos, PDSE)
else else
NewPos.y = this.pos.y + Base.size.ascent; NewPos.y = this.pos.y + Base.size.ascent;
Base.setPosition(NewPos, PDSE); // base Base.setPosition(NewPos, Line, Range); // base
pos.x += this.size.width; pos.x += this.size.width;
} }
......
...@@ -85,19 +85,11 @@ CDegreeBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsI ...@@ -85,19 +85,11 @@ CDegreeBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsI
this.bNaryInline = RPI.bNaryInline; this.bNaryInline = RPI.bNaryInline;
this.iterContent.PreRecalc(this, ParaMath, ArgSzDegr, RPIDegr); this.iterContent.PreRecalc(this, ParaMath, ArgSzDegr, RPIDegr);
} };
CDegreeBase.prototype.Resize = function(oMeasure, RPI) CDegreeBase.prototype.Resize = function(oMeasure, RPI)
{ {
//this.Parent = Parent;
//this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
this.baseContent.Resize(oMeasure, RPI); this.baseContent.Resize(oMeasure, RPI);
//var ArgSzDegr = ArgSize.Copy();
//ArgSzDegr.decrease();
this.iterContent.Resize(oMeasure, RPI); this.iterContent.Resize(oMeasure, RPI);
if(this.Pr.type === DEGREE_SUPERSCRIPT) if(this.Pr.type === DEGREE_SUPERSCRIPT)
...@@ -114,11 +106,10 @@ CDegreeBase.prototype.recalculateSize = function(oMeasure) ...@@ -114,11 +106,10 @@ CDegreeBase.prototype.recalculateSize = function(oMeasure)
}; };
CDegreeBase.prototype.recalculateSup = function(oMeasure) CDegreeBase.prototype.recalculateSup = function(oMeasure)
{ {
var base = this.elements[0][0].size, var base = this.baseContent.size,
iter = this.elements[0][1].size; iter = this.iterContent.size;
var mgCtrPrp = this.Get_TxtPrControlLetter(); var mgCtrPrp = this.Get_TxtPrControlLetter();
//var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
this.upBase = 0; this.upBase = 0;
this.upIter = 0; this.upIter = 0;
...@@ -271,7 +262,7 @@ CDegreeBase.prototype.recalculateSubScript = function(oMeasure) ...@@ -271,7 +262,7 @@ CDegreeBase.prototype.recalculateSubScript = function(oMeasure)
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
}; };
CDegreeBase.prototype.setPosition = function(pos, PDSE) CDegreeBase.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
...@@ -296,34 +287,11 @@ CDegreeBase.prototype.setPosition = function(pos, PDSE) ...@@ -296,34 +287,11 @@ CDegreeBase.prototype.setPosition = function(pos, PDSE)
PosIter.x = this.pos.x + this.GapLeft + oBase.size.width + this.dW; PosIter.x = this.pos.x + this.GapLeft + oBase.size.width + this.dW;
PosIter.y = this.pos.y + this.upIter + oIter.size.ascent; PosIter.y = this.pos.y + this.upIter + oIter.size.ascent;
oBase.setPosition(PosBase, PDSE); oBase.setPosition(PosBase, Line, Range);
oIter.setPosition(PosIter, PDSE); oIter.setPosition(PosIter, Line, Range);
pos.x += this.size.width; pos.x += this.size.width;
}; };
CDegreeBase.prototype.old_setPosition = function(pos, PosInfo)
{
this.pos.x = pos.x;
if(this.bInside === true)
this.pos.y = pos.y;
else
this.pos.y = pos.y - this.size.ascent;
var PosBase = new CMathPosition();
PosBase.x = this.pos.x + this.GapLeft;
PosBase.y = this.pos.y + this.upBase;
var PosIter = new CMathPosition();
PosIter.x = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW;
PosIter.y = this.pos.y + this.upIter;
this.elements[0][0].setPosition(PosBase, PosInfo);
this.elements[0][1].setPosition(PosIter, PosInfo);
};
CDegreeBase.prototype.getIterator = function() CDegreeBase.prototype.getIterator = function()
{ {
return this.iterContent; return this.iterContent;
......
...@@ -378,7 +378,7 @@ CFraction.prototype.recalculateLinear = function() ...@@ -378,7 +378,7 @@ CFraction.prototype.recalculateLinear = function()
this.size = {height: height, width: width, ascent: ascent}; this.size = {height: height, width: width, ascent: ascent};
} }
CFraction.prototype.setPosition = function(pos, PDSE) CFraction.prototype.setPosition = function(pos, Line, Range)
{ {
if(this.Pr.type == SKEWED_FRACTION) if(this.Pr.type == SKEWED_FRACTION)
{ {
...@@ -401,13 +401,13 @@ CFraction.prototype.setPosition = function(pos, PDSE) ...@@ -401,13 +401,13 @@ CFraction.prototype.setPosition = function(pos, PDSE)
PosDen.x = X + Numerator.size.width + this.dW; PosDen.x = X + Numerator.size.width + this.dW;
PosDen.y = Y + Numerator.size.height + Denominator.size.ascent; PosDen.y = Y + Numerator.size.height + Denominator.size.ascent;
Numerator.setPosition(PosNum, PDSE); Numerator.setPosition(PosNum, Line, Range);
Denominator.setPosition(PosDen, PDSE); Denominator.setPosition(PosDen, Line, Range);
pos.x += this.size.width; pos.x += this.size.width;
} }
else else
CFraction.superclass.setPosition.call(this, pos, PDSE); CFraction.superclass.setPosition.call(this, pos, Line, Range);
} }
CFraction.prototype.fillContent = function() CFraction.prototype.fillContent = function()
{ {
...@@ -559,10 +559,10 @@ CDenominator.prototype.recalculateSize = function() ...@@ -559,10 +559,10 @@ CDenominator.prototype.recalculateSize = function()
this.size = {width : width, height: height, ascent: ascent}; this.size = {width : width, height: height, ascent: ascent};
} }
CDenominator.prototype.setPosition = function(pos, PDSE) CDenominator.prototype.setPosition = function(pos, Line, Range)
{ {
pos.y += this.gap; pos.y += this.gap;
CDenominator.superclass.setPosition.call(this, pos, PDSE); CDenominator.superclass.setPosition.call(this, pos, Line, Range);
} }
////////// //////////
...@@ -680,7 +680,7 @@ function CMathContent() ...@@ -680,7 +680,7 @@ function CMathContent()
this.plhHide = false; this.plhHide = false;
this.bRoot = false; this.bRoot = false;
this.bMath_OneLine = false; this.bOneLine = false;
////////////////// //////////////////
...@@ -991,14 +991,14 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths ...@@ -991,14 +991,14 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths
} }
}; };
CMathContent.prototype.setPosition = function(pos, PDSE) CMathContent.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y; this.pos.y = pos.y;
var StartPos, EndPos; var StartPos, EndPos;
var CurLine = PDSE.Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSE.Range - this.StartRange : PDSE.Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
StartPos = this.protected_GetRangeStartPos(CurLine, CurRange); StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
EndPos = this.protected_GetRangeEndPos(CurLine, CurRange); EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
...@@ -1015,9 +1015,9 @@ CMathContent.prototype.setPosition = function(pos, PDSE) ...@@ -1015,9 +1015,9 @@ CMathContent.prototype.setPosition = function(pos, PDSE)
for(var i = StartPos; i <= EndPos; i++) for(var i = StartPos; i <= EndPos; i++)
{ {
if(this.Content[i].Type == para_Math_Run) if(this.Content[i].Type == para_Math_Run)
this.Content[i].Math_SetPosition(pos, PDSE); this.Content[i].Math_SetPosition(pos, Line, Range);
else else
this.Content[i].setPosition(pos, PDSE); this.Content[i].setPosition(pos, Line, Range);
} }
}; };
CMathContent.prototype.old_setPosition = function(pos) CMathContent.prototype.old_setPosition = function(pos)
...@@ -3970,7 +3970,7 @@ CMathContent.prototype.private_SetNeedResize = function() ...@@ -3970,7 +3970,7 @@ CMathContent.prototype.private_SetNeedResize = function()
}; };
CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{ {
this.bMath_OneLine = PRS.bMath_OneLine; this.bOneLine = PRS.bMath_OneLine;
var CurLine = PRS.Line - this.StartLine; var CurLine = PRS.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range ); var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range );
...@@ -3978,7 +3978,7 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -3978,7 +3978,7 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ContentLen = this.Content.length; var ContentLen = this.Content.length;
var RangeStartPos = this.protected_AddRange(CurLine, CurRange); var RangeStartPos = this.protected_AddRange(CurLine, CurRange);
var RangeEndPos = this.bMath_OneLine ? ContentLen - 1 : 0; var RangeEndPos = this.bOneLine ? ContentLen - 1 : 0;
this.InfoPoints.SetDefault(); this.InfoPoints.SetDefault();
...@@ -4011,12 +4011,12 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -4011,12 +4011,12 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
Type = Item.Type; Type = Item.Type;
// для однострочных мат объектов обновляем CurLine и CurRange, Run в этом случае не могут разбиваться на несколько строк // для однострочных мат объектов обновляем CurLine и CurRange, Run в этом случае не могут разбиваться на несколько строк
if (this.bMath_OneLine || (0 === Pos && 0 === CurLine && 0 === CurRange ) || Pos !== RangeStartPos) if (this.bOneLine || (0 === Pos && 0 === CurLine && 0 === CurRange ) || Pos !== RangeStartPos)
Item.Recalculate_Reset( PRS.Range, PRS.Line ); Item.Recalculate_Reset( PRS.Range, PRS.Line );
PRS.Update_CurPos( Pos, Depth ); PRS.Update_CurPos( Pos, Depth );
if(this.bMath_OneLine) // контент занимает всегда(!) одну строку if(this.bOneLine) // контент занимает всегда(!) одну строку
{ {
Item.Recalculate_Range_OneLine(PRS, ParaPr, Depth + 1); Item.Recalculate_Range_OneLine(PRS, ParaPr, Depth + 1);
...@@ -4147,6 +4147,85 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -4147,6 +4147,85 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos); this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos);
}; };
CMathContent.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var CurPos = this.CurPos;
var Result;
if(this.Content[CurPos].Type == para_Math_Composition)
{
Result = this.Content[CurPos].Get_StartRangePos(_CurLine, _CurRange, SearchPos, Depth + 1);
if ( true === Result )
{
SearchPos.Pos.Update( CurPos, Depth );
}
else if(this.bRoot)
{
Result = this.Content[StartPos].Math_Get_StartRangePos(true, _CurLine, _CurRange, SearchPos, Depth + 1);
if ( true === Result )
SearchPos.Pos.Update(StartPos, Depth);
}
}
else
{
// в начале контента может стоять пустой Run перед мат объектом, поэтому здесь важно различать две ситуации: мы стоим в начале контента или нет(когда нажата клавиша Home). В последнем случае нужно встать в пустой Run в начале контента, если в начале стоит мат объект.
var bUpdStartLine = StartPos < CurPos;
var bUpdNotFirstLine = this.bRoot && CurLine !== 0;
Result = this.Content[StartPos].Math_Get_StartRangePos(bUpdStartLine || bUpdNotFirstLine, _CurLine, _CurRange, SearchPos, Depth + 1);
if ( true === Result )
SearchPos.Pos.Update(StartPos, Depth );
}
return Result;
};
CMathContent.prototype.Get_EndRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var CurPos = this.CurPos;
var Result;
if(this.Content[CurPos].Type == para_Math_Composition)
{
Result = this.Content[CurPos].Get_EndRangePos(_CurLine, _CurRange, SearchPos, Depth + 1);
if ( true === Result )
{
SearchPos.Pos.Update( CurPos, Depth );
}
else if(this.bRoot)
{
Result = this.Content[EndPos].Math_Get_EndRangePos(true, _CurLine, _CurRange, SearchPos, Depth + 1);
if ( true === Result )
SearchPos.Pos.Update(EndPos, Depth );
}
}
else
{
var bUpdEndLine = CurPos < EndPos;
var bUpdNotLastLine = this.bRoot && CurLine !== this.protected_GetLinesCount() - 1;
Result = this.Content[EndPos].Math_Get_EndRangePos(bUpdEndLine || bUpdNotLastLine, _CurLine, _CurRange, SearchPos, Depth + 1);
if ( true === Result )
SearchPos.Pos.Update(EndPos, Depth );
}
return Result;
};
CMathContent.prototype.IsFirstLine = function(Line) CMathContent.prototype.IsFirstLine = function(Line)
{ {
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
......
...@@ -462,7 +462,7 @@ CMathMatrix.prototype.init = function(props) ...@@ -462,7 +462,7 @@ CMathMatrix.prototype.init = function(props)
this.fillContent(); this.fillContent();
} }
CMathMatrix.prototype.setPosition = function(pos, PDSE) CMathMatrix.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
...@@ -489,7 +489,7 @@ CMathMatrix.prototype.setPosition = function(pos, PDSE) ...@@ -489,7 +489,7 @@ CMathMatrix.prototype.setPosition = function(pos, PDSE)
NewPos.x = this.pos.x + this.GapLeft + al.x + w; NewPos.x = this.pos.x + this.GapLeft + al.x + w;
NewPos.y = this.pos.y + al.y + h + Item.size.ascent; NewPos.y = this.pos.y + al.y + h + Item.size.ascent;
Item.setPosition(NewPos, PDSE); Item.setPosition(NewPos, Line, Range);
w += Widths[j] + this.gaps.column[j]; w += Widths[j] + this.gaps.column[j];
} }
h += Heights[i] + this.gaps.row[i]; h += Heights[i] + this.gaps.row[i];
...@@ -838,27 +838,9 @@ CEqArray.prototype.getMetrics = function() ...@@ -838,27 +838,9 @@ CEqArray.prototype.getMetrics = function()
DescentsMetrics[i] = size.height - size.ascent; DescentsMetrics[i] = size.height - size.ascent;
} }
/*for(var tt = 0; tt < this.nCol; tt++ )
Widths[tt] = 0;
for(var i=0; i < this.nRow; i++)
{
Ascents[i] = 0;
Descents[i] = 0;
for(var j = 0; j < this.nCol ; j++)
{
var size = this.elements[i][j].size;
Widths[j] = i > 0 && ( Widths[j] > size.width ) ? Widths[j] : size.width;
Ascents[i] = (Ascents[i] > size.ascent ) ? Ascents[i] : size.ascent;
Descents[i] = (Descents[i] > size.height - size.ascent ) ? Descents[i] : size.height - size.ascent;
}
}*/
return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics}; return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics};
} }
CEqArray.prototype.setPosition = function(pos, PDSE) CEqArray.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
...@@ -880,7 +862,7 @@ CEqArray.prototype.setPosition = function(pos, PDSE) ...@@ -880,7 +862,7 @@ CEqArray.prototype.setPosition = function(pos, PDSE)
NewPos.x = this.pos.x + this.GapLeft; NewPos.x = this.pos.x + this.GapLeft;
NewPos.y = this.pos.y + h + Item.size.ascent; NewPos.y = this.pos.y + h + Item.size.ascent;
Item.setPosition(NewPos, PDSE); Item.setPosition(NewPos, Line, Range);
h += Heights[i] + this.gaps.row[i]; h += Heights[i] + this.gaps.row[i];
} }
......
...@@ -626,7 +626,7 @@ CNaryUndOvr.prototype.recalculateSize = function() ...@@ -626,7 +626,7 @@ CNaryUndOvr.prototype.recalculateSize = function()
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
} }
CNaryUndOvr.prototype.setPosition = function(pos, PDSE) CNaryUndOvr.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y; this.pos.y = pos.y;
...@@ -652,9 +652,9 @@ CNaryUndOvr.prototype.setPosition = function(pos, PDSE) ...@@ -652,9 +652,9 @@ CNaryUndOvr.prototype.setPosition = function(pos, PDSE)
PosLowIter.x = pos.x + this.GapLeft + this.align(2,0).x; PosLowIter.x = pos.x + this.GapLeft + this.align(2,0).x;
PosLowIter.y = PosSign.y + Sign.size.height + this.gapBottom + LowIter.size.ascent; PosLowIter.y = PosSign.y + Sign.size.height + this.gapBottom + LowIter.size.ascent;
UpIter.setPosition(PosUpIter, PDSE); UpIter.setPosition(PosUpIter, Line, Range);
Sign.setPosition(PosSign, PDSE); Sign.setPosition(PosSign, Line, Range);
LowIter.setPosition(PosLowIter, PDSE); LowIter.setPosition(PosLowIter, Line, Range);
} }
CNaryUndOvr.prototype.setBase = function(base) CNaryUndOvr.prototype.setBase = function(base)
{ {
......
...@@ -3762,7 +3762,7 @@ CDelimiter.prototype.alignOperator = function(operator) // в качестве ...@@ -3762,7 +3762,7 @@ CDelimiter.prototype.alignOperator = function(operator) // в качестве
return align; return align;
} }
CDelimiter.prototype.setPosition = function(position, PDSE) CDelimiter.prototype.setPosition = function(position, Line, Range)
{ {
this.pos.x = position.x; this.pos.x = position.x;
this.pos.y = position.y - this.size.ascent; this.pos.y = position.y - this.size.ascent;
...@@ -3785,7 +3785,7 @@ CDelimiter.prototype.setPosition = function(position, PDSE) ...@@ -3785,7 +3785,7 @@ CDelimiter.prototype.setPosition = function(position, PDSE)
PosContent.y = y + this.align_2(content) + content.size.ascent; PosContent.y = y + this.align_2(content) + content.size.ascent;
x += content.size.width; x += content.size.width;
content.setPosition(PosContent, PDSE); // CMathContent content.setPosition(PosContent, Line, Range); // CMathContent
var Positions = []; var Positions = [];
...@@ -3804,7 +3804,7 @@ CDelimiter.prototype.setPosition = function(position, PDSE) ...@@ -3804,7 +3804,7 @@ CDelimiter.prototype.setPosition = function(position, PDSE)
NewPosContent.x = x; NewPosContent.x = x;
NewPosContent.y = y + this.align_2(content) + content.size.ascent; NewPosContent.y = y + this.align_2(content) + content.size.ascent;
content.setPosition(NewPosContent, PDSE); content.setPosition(NewPosContent, Line, Range);
x += content.size.width; x += content.size.width;
} }
...@@ -3920,7 +3920,7 @@ CCharacter.prototype.recalculateSize = function(oMeasure) ...@@ -3920,7 +3920,7 @@ CCharacter.prototype.recalculateSize = function(oMeasure)
this.size = {height: height, width: width, ascent: ascent}; this.size = {height: height, width: width, ascent: ascent};
} }
CCharacter.prototype.setPosition = function(pos, PDSE) CCharacter.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent; this.pos.y = pos.y - this.size.ascent;
...@@ -3945,14 +3945,14 @@ CCharacter.prototype.setPosition = function(pos, PDSE) ...@@ -3945,14 +3945,14 @@ CCharacter.prototype.setPosition = function(pos, PDSE)
PosBase.x = this.pos.x + this.GapLeft + alignCnt; PosBase.x = this.pos.x + this.GapLeft + alignCnt;
PosBase.y = this.pos.y + this.operator.size.height + Base.size.ascent; PosBase.y = this.pos.y + this.operator.size.height + Base.size.ascent;
Base.setPosition(PosBase, PDSE); Base.setPosition(PosBase, Line, Range);
} }
else if(this.Pr.pos === LOCATION_BOT) else if(this.Pr.pos === LOCATION_BOT)
{ {
PosBase.x = this.pos.x + this.GapLeft + alignCnt; PosBase.x = this.pos.x + this.GapLeft + alignCnt;
PosBase.y = this.pos.y + Base.size.ascent; PosBase.y = this.pos.y + Base.size.ascent;
Base.setPosition(PosBase, PDSE); Base.setPosition(PosBase, Line, Range);
PosOper.x = this.pos.x + this.GapLeft + alignOp; PosOper.x = this.pos.x + this.GapLeft + alignOp;
PosOper.y = this.pos.y + Base.size.height; PosOper.y = this.pos.y + Base.size.height;
......
...@@ -587,7 +587,7 @@ CRadical.prototype.Resize = function(oMeasure, RPI) ...@@ -587,7 +587,7 @@ CRadical.prototype.Resize = function(oMeasure, RPI)
this.recalculateSize(oMeasure); this.recalculateSize(oMeasure);
} }
CRadical.prototype.setPosition = function(pos, PDSE) CRadical.prototype.setPosition = function(pos, Line, Range)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent; this.pos.y = pos.y - this.size.ascent;
...@@ -607,7 +607,7 @@ CRadical.prototype.setPosition = function(pos, PDSE) ...@@ -607,7 +607,7 @@ CRadical.prototype.setPosition = function(pos, PDSE)
PosBase.y = this.pos.y + gapTop + this.RealBase.size.ascent; PosBase.y = this.pos.y + gapTop + this.RealBase.size.ascent;
this.signRadical.setPosition(PosRadical); this.signRadical.setPosition(PosRadical);
this.RealBase.setPosition(PosBase, PDSE); this.RealBase.setPosition(PosBase, Line, Range);
} }
else if(this.Pr.type == DEGREE_RADICAL) else if(this.Pr.type == DEGREE_RADICAL)
{ {
...@@ -618,7 +618,7 @@ CRadical.prototype.setPosition = function(pos, PDSE) ...@@ -618,7 +618,7 @@ CRadical.prototype.setPosition = function(pos, PDSE)
PosDegree.x = this.pos.x + this.GapLeft + this.gapWidth; PosDegree.x = this.pos.x + this.GapLeft + this.gapWidth;
PosDegree.y = this.pos.y + this.gapDegree + this.Iterator.size.ascent; PosDegree.y = this.pos.y + this.gapDegree + this.Iterator.size.ascent;
this.Iterator.setPosition(PosDegree, PDSE); this.Iterator.setPosition(PosDegree, Line, Range);
var wDegree = this.Iterator.size.width > wTick ? this.Iterator.size.width - wTick : 0; var wDegree = this.Iterator.size.width > wTick ? this.Iterator.size.width - wTick : 0;
...@@ -630,7 +630,7 @@ CRadical.prototype.setPosition = function(pos, PDSE) ...@@ -630,7 +630,7 @@ CRadical.prototype.setPosition = function(pos, PDSE)
PosBase.x = this.pos.x + this.size.width - this.RealBase.size.width - this.GapRight; PosBase.x = this.pos.x + this.size.width - this.RealBase.size.width - this.GapRight;
PosBase.y = this.pos.y + this.size.ascent; PosBase.y = this.pos.y + this.size.ascent;
this.RealBase.setPosition(PosBase, PDSE); this.RealBase.setPosition(PosBase, Line, Range);
} }
pos.x += this.size.width; pos.x += this.size.width;
......
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