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

Переделала свойство alnAt в brk (при рассчете выравнивания учитываются все операторы в формуле)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@64095 954022d7-b5bf-4e40-9824-e11837661b57
parent b9cf90b1
...@@ -756,13 +756,23 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, _Page, _X, _X ...@@ -756,13 +756,23 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, _Page, _X, _X
var WrapState = this.PageInfo.GetWrap(Page); var WrapState = this.PageInfo.GetWrap(Page);
var bFirstLine = this.Root.IsStartLine(_CurLine); var bFirstLine = this.Root.IsStartLine(_CurLine);
/*var wrap = 0; // выставим сначала Position до пересчета выравнивания для формулы
var wrapIndent = MathSettings.Get_WrapIndent(WrapState); // для расчета смещений относительно операторов
if(bFirstLine == false && true == MathSettings.IsWrap(WrapState)) var PosInfo = new CMathPosInfo();
PosInfo.CurLine = _CurLine;
PosInfo.CurRange = _CurRange;
if(true == this.NeedDispOperators(_CurLine))
{ {
wrap = this.Root.Get_WrapToLine(_CurLine, _CurRange, wrapIndent); this.DispositionOpers.length = 0;
}*/ PosInfo.DispositionOpers = this.DispositionOpers;
}
var pos = new CMathPosition();
this.Root.setPosition(pos, PosInfo);
var XStart, XEnd; var XStart, XEnd;
...@@ -1206,12 +1216,6 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1206,12 +1216,6 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.ParaMathRPI.ResetInfoRanges(); this.ParaMathRPI.ResetInfoRanges();
} }
if(true == this.NeedDispOperators(PRS))
{
this.DispositionOpers.length = 0;
PRS.DispositionOpers = this.DispositionOpers;
}
if(bUpdateWrapMath == true && this.ParaMathRPI.bInternalRanges == false && PRS.bFastRecalculate == false) if(bUpdateWrapMath == true && this.ParaMathRPI.bInternalRanges == false && PRS.bFastRecalculate == false)
{ {
this.ParaMathRPI.bInternalRanges = true; this.ParaMathRPI.bInternalRanges = true;
...@@ -1605,9 +1609,7 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange ...@@ -1605,9 +1609,7 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
if ( this.Paragraph !== null) if ( this.Paragraph !== null)
Page = this.Paragraph.Get_StartPage_Absolute(); Page = this.Paragraph.Get_StartPage_Absolute();
var pos = new CMathPosition(); this.Root.UpdateBoundsPosInfo(PRSA, _CurLine, _CurRange, Page + _CurPage);
this.Root.setPosition(pos, PRSA, _CurLine, _CurRange, Page + _CurPage);
this.Root.Recalculate_Range_Spaces(PRSA, _CurLine, _CurRange, Page + _CurPage); this.Root.Recalculate_Range_Spaces(PRSA, _CurLine, _CurRange, Page + _CurPage);
}; };
...@@ -1731,12 +1733,11 @@ ParaMath.prototype.Get_Inline = function() ...@@ -1731,12 +1733,11 @@ ParaMath.prototype.Get_Inline = function()
}; };
ParaMath.prototype.Is_Inline = function() ParaMath.prototype.Is_Inline = function()
{ {
//return this.ParaMathRPI.bInline;
return this.ParaMathRPI.bInline == true || (this.ParaMathRPI.bInternalRanges == true && this.ParaMathRPI.bStartRanges == false); return this.ParaMathRPI.bInline == true || (this.ParaMathRPI.bInternalRanges == true && this.ParaMathRPI.bStartRanges == false);
}; };
ParaMath.prototype.NeedDispOperators = function(PRS) ParaMath.prototype.NeedDispOperators = function(Line)
{ {
return false === this.Is_Inline() && true == this.Root.IsStartLine(PRS.Line); return false === this.Is_Inline() && true == this.Root.IsStartLine(Line);
}; };
ParaMath.prototype.Get_Align = function() ParaMath.prototype.Get_Align = function()
{ {
...@@ -1897,7 +1898,7 @@ ParaMath.prototype.MathToImageConverter = function(bCopy, _canvasInput, _widthPx ...@@ -1897,7 +1898,7 @@ ParaMath.prototype.MathToImageConverter = function(bCopy, _canvasInput, _widthPx
}; };
ParaMath.prototype.GetFirstRPrp = function() ParaMath.prototype.GetFirstRPrp = function()
{ {
return this.Root.getFirstRPrp(this); return this.Root.getFirstRPrp();
}; };
ParaMath.prototype.GetShiftCenter = function(oMeasure, font) ParaMath.prototype.GetShiftCenter = function(oMeasure, font)
{ {
......
...@@ -2199,7 +2199,6 @@ function CParagraphRecalculateStateWrap(Para) ...@@ -2199,7 +2199,6 @@ function CParagraphRecalculateStateWrap(Para)
this.OperGapRight = 0; this.OperGapRight = 0;
this.OperGapLeft = 0; this.OperGapLeft = 0;
this.bNoOneBreakOperator = true; // прежде чем обновлять позицию в контент Run, учтем были ли до этого break-операторы (проверки на Word == false не достаточно, т.к. формула мб инлайновая и тогда не нужно обновлять позицию) this.bNoOneBreakOperator = true; // прежде чем обновлять позицию в контент Run, учтем были ли до этого break-операторы (проверки на Word == false не достаточно, т.к. формула мб инлайновая и тогда не нужно обновлять позицию)
this.DispositionOpers = [];
this.BreakBox = false; this.BreakBox = false;
this.bInsideOper = false; // учитываем есть ли разбивка внутри мат объекта, чтобы случайно не вставить в конец пред оператора (при Brk_Before == false) this.bInsideOper = false; // учитываем есть ли разбивка внутри мат объекта, чтобы случайно не вставить в конец пред оператора (при Brk_Before == false)
this.bOnlyForcedBreak = false; // учитывается, если возможна разбивка только по операторам выше уровням => в этом случае можно сделать принудительный разрыв во внутреннем контенте this.bOnlyForcedBreak = false; // учитывается, если возможна разбивка только по операторам выше уровням => в этом случае можно сделать принудительный разрыв во внутреннем контенте
...@@ -2244,7 +2243,6 @@ CParagraphRecalculateStateWrap.prototype = ...@@ -2244,7 +2243,6 @@ CParagraphRecalculateStateWrap.prototype =
this.bFastRecalculate = false; this.bFastRecalculate = false;
this.bBoxOperator = false; this.bBoxOperator = false;
this.BreakBox = false; this.BreakBox = false;
this.DispositionOpers = []; // выставляем ссылку на новый массив ! length нельзя обнулять, т.к. при пересчете передаем ссылку на массив из ParaMath, чтобы после не пришлось копировать элементы массива
}, },
// Обнуляем некоторые параметры перед новым отрезком // Обнуляем некоторые параметры перед новым отрезком
......
...@@ -2433,16 +2433,6 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2433,16 +2433,6 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
} }
} }
if(PRS.NewRange == false && true === this.ParaMath.NeedDispOperators(PRS))
{
var W = X - XRange + Item.GapLeft;
if(bOperBefore == false)
W -= BrkLen
PRS.DispositionOpers.push(W);
}
break; break;
} }
case para_Drawing: case para_Drawing:
...@@ -9057,8 +9047,11 @@ function CRunCollaborativeRange(PosS, PosE, Color) ...@@ -9057,8 +9047,11 @@ function CRunCollaborativeRange(PosS, PosE, Color)
this.Color = Color; this.Color = Color;
} }
ParaRun.prototype.Math_SetPosition = function(pos, PRSA, Line, Range, Page) ParaRun.prototype.Math_SetPosition = function(pos, PosInfo)
{ {
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
...@@ -9069,10 +9062,16 @@ ParaRun.prototype.Math_SetPosition = function(pos, PRSA, Line, Range, Page) ...@@ -9069,10 +9062,16 @@ ParaRun.prototype.Math_SetPosition = function(pos, PRSA, Line, Range, Page)
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y; this.pos.y = pos.y;
for(var i = StartPos; i < EndPos; i++) for(var Pos = StartPos; Pos < EndPos; Pos++)
{
var Item = this.Content[Pos];
if(PosInfo.DispositionOpers !== null && Item.Type == para_Math_BreakOperator)
{ {
this.Content[i].setPosition(pos); PosInfo.DispositionOpers.push(pos.x + Item.GapLeft);
pos.x += this.Content[i].Get_WidthVisible(); // Get_Width => Get_WidthVisible }
this.Content[Pos].setPosition(pos);
pos.x += this.Content[Pos].Get_WidthVisible(); // Get_Width => Get_WidthVisible
// Get_WidthVisible - Width + Gaps с учетом настроек состояния // Get_WidthVisible - Width + Gaps с учетом настроек состояния
} }
}; };
...@@ -9199,7 +9198,6 @@ ParaRun.prototype.Math_RecalculateContent = function(PRS) ...@@ -9199,7 +9198,6 @@ ParaRun.prototype.Math_RecalculateContent = function(PRS)
var WidthItem = Item.Get_WidthVisible(); // Get_Width => Get_WidthVisible var WidthItem = Item.Get_WidthVisible(); // Get_Width => Get_WidthVisible
// Get_WidthVisible - Width + Gaps с учетом настроек состояния // Get_WidthVisible - Width + Gaps с учетом настроек состояния
width += WidthItem; width += WidthItem;
if(ascent < size.ascent) if(ascent < size.ascent)
......
...@@ -467,12 +467,12 @@ CAccent.prototype.IsAccent = function() ...@@ -467,12 +467,12 @@ CAccent.prototype.IsAccent = function()
{ {
return true; return true;
}; };
CAccent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CAccent.prototype.setPosition = function(pos, PosInfo)
{ {
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;
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var width = this.size.width - this.GapLeft - this.GapRight; var width = this.size.width - this.GapLeft - this.GapRight;
var oBase = this.Content[0]; var oBase = this.Content[0];
...@@ -492,7 +492,7 @@ CAccent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -492,7 +492,7 @@ CAccent.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); oBase.setPosition(PosBase, PosInfo);
pos.x += this.size.width; pos.x += this.size.width;
}; };
......
...@@ -292,9 +292,9 @@ CMathBase.prototype.align = function(pos_x, pos_y) ...@@ -292,9 +292,9 @@ CMathBase.prototype.align = function(pos_x, pos_y)
return PosAlign; return PosAlign;
}; };
CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CMathBase.prototype.setPosition = function(pos, PosInfo)
{ {
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
if(this.bOneLine) if(this.bOneLine)
{ {
...@@ -325,7 +325,7 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -325,7 +325,7 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); this.elements[i][j].setPosition(NewPos, PosInfo);
w += Widths[j]; w += Widths[j];
} }
h += Heights[i]; h += Heights[i];
...@@ -335,6 +335,8 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -335,6 +335,8 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
} }
else else
{ {
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
...@@ -344,12 +346,12 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -344,12 +346,12 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
if(CurLine == 0 && CurRange == 0) if(CurLine == 0 && CurRange == 0)
pos.x += this.BrGapLeft; pos.x += this.BrGapLeft;
this.Content[StartPos].setPosition(pos, PRSA, Line, Range, Page); this.Content[StartPos].setPosition(pos, PosInfo);
for(var Pos = StartPos + 1; Pos <= EndPos; Pos++) for(var Pos = StartPos + 1; Pos <= EndPos; Pos++)
{ {
pos.x += this.dW; pos.x += this.dW;
this.Content[Pos].setPosition(pos, PRSA, Line, Range, Page); this.Content[Pos].setPosition(pos, PosInfo);
} }
var Len = this.Content.length; var Len = this.Content.length;
...@@ -424,13 +426,29 @@ CMathBase.prototype.IsLastRange = function(_CurLine, _CurRange) ...@@ -424,13 +426,29 @@ CMathBase.prototype.IsLastRange = function(_CurLine, _CurRange)
return CurLine == LinesCount - 1 && CurRange == RangesCount - 1; return CurLine == LinesCount - 1 && CurRange == RangesCount - 1;
}; };
CMathBase.prototype.UpdatePosBound = function(pos, PRSA, Line, Range, Page) CMathBase.prototype.UpdatePosBound = function(pos, PosInfo)
{ {
var CurLine = Line - this.StartLine; var CurLine = PosInfo.CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range); var CurRange = ( 0 === CurLine ? PosInfo.CurRange - this.StartRange : PosInfo.CurRange);
this.Bounds.SetPos(CurLine, CurRange, pos, PRSA); this.Bounds.SetPos(CurLine, CurRange, pos);
this.Bounds.SetPage(CurLine, CurRange, Page); };
CMathBase.prototype.UpdateBoundsPosInfo = function(PRSA, _CurLine, _CurRange, _CurPage)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange);
this.Bounds.SetGenPos(CurLine, CurRange, PRSA);
this.Bounds.SetPage(CurLine, CurRange, _CurPage);
for(var i=0; i < this.nRow; i++)
{
for(var j = 0; j < this.nCol; j++)
{
if(false == this.elements[i][j].IsJustDraw())
this.elements[i][j].UpdateBoundsPosInfo(PRSA, _CurLine, _CurRange, _CurPage);
}
}
}; };
CMathBase.prototype.draw = function(x, y, pGraphics, PDSE) CMathBase.prototype.draw = function(x, y, pGraphics, PDSE)
{ {
...@@ -2366,10 +2384,15 @@ CMathBounds.prototype.Get_LineBound = function(CurLine, CurRange) ...@@ -2366,10 +2384,15 @@ CMathBounds.prototype.Get_LineBound = function(CurLine, CurRange)
return Bound; return Bound;
}; };
CMathBounds.prototype.SetPos = function(Line, Range, Pos, PRSA) CMathBounds.prototype.SetPos = function(Line, Range, Pos)
{
this.CheckLineBound(Line, Range);
this.Bounds[Line][Range].SetPos(Pos);
};
CMathBounds.prototype.SetGenPos = function(Line, Range, PRSA)
{ {
this.CheckLineBound(Line, Range); this.CheckLineBound(Line, Range);
this.Bounds[Line][Range].SetPos(Pos, PRSA); this.Bounds[Line][Range].SetGenPos(PRSA);
}; };
CMathBounds.prototype.ShiftPos = function(Line, Range, Dx, Dy) CMathBounds.prototype.ShiftPos = function(Line, Range, Dx, Dy)
{ {
...@@ -2390,8 +2413,14 @@ CMathBounds.prototype.GetPos = function(Line, Range) ...@@ -2390,8 +2413,14 @@ CMathBounds.prototype.GetPos = function(Line, Range)
function CMathBoundsMeasures() function CMathBoundsMeasures()
{ {
this.Type = MATH_BOUNDS_MEASURES; this.Type = MATH_BOUNDS_MEASURES;
// нужны ля расчета выравниваний относительно операторов
this._X = 0;
this._Y = 0;
// необходимы для отрисовки рамки, подсветки
this.X = 0; this.X = 0;
this.Y = 0; this.Y = 0;
this.W = 0; this.W = 0;
this.H = 0; this.H = 0;
this.Asc = 0; this.Asc = 0;
...@@ -2421,10 +2450,15 @@ CMathBoundsMeasures.prototype.SetWidth = function(Width) ...@@ -2421,10 +2450,15 @@ CMathBoundsMeasures.prototype.SetWidth = function(Width)
{ {
this.W = Width; this.W = Width;
}; };
CMathBoundsMeasures.prototype.SetPos = function(Pos, PRSA) CMathBoundsMeasures.prototype.SetGenPos = function(PRSA)
{
this.X = PRSA.X + this._X;
this.Y = PRSA.Y + this._Y;
};
CMathBoundsMeasures.prototype.SetPos = function(Pos)
{ {
this.X = PRSA.X + Pos.x; this._X = Pos.x;
this.Y = PRSA.Y + Pos.y - this.Asc; this._Y = Pos.y - this.Asc;
}; };
CMathBoundsMeasures.prototype.ShiftPos = function(Dx, Dy) CMathBoundsMeasures.prototype.ShiftPos = function(Dx, Dy)
{ {
...@@ -2445,7 +2479,7 @@ CMathBoundsMeasures.prototype.SetPage = function(Page) ...@@ -2445,7 +2479,7 @@ CMathBoundsMeasures.prototype.SetPage = function(Page)
}; };
CMathBoundsMeasures.prototype.ShiftPage = function(Dx) CMathBoundsMeasures.prototype.ShiftPage = function(Dx)
{ {
this.Page +=Dx; this.Page += Dx;
}; };
......
...@@ -361,12 +361,12 @@ CBorderBox.prototype.Draw_Elements = function(PDSE) ...@@ -361,12 +361,12 @@ CBorderBox.prototype.Draw_Elements = function(PDSE)
PDSE.X = _X + this.size.width; PDSE.X = _X + this.size.width;
}; };
CBorderBox.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CBorderBox.prototype.setPosition = function(pos, PosInfo)
{ {
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;
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var NewPos = new CMathPosition(); var NewPos = new CMathPosition();
...@@ -383,7 +383,7 @@ CBorderBox.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -383,7 +383,7 @@ CBorderBox.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
else else
NewPos.y = this.pos.y + Base.size.ascent; NewPos.y = this.pos.y + Base.size.ascent;
Base.setPosition(NewPos, PRSA, Line, Range, Page); // base Base.setPosition(NewPos, PosInfo);
pos.x += this.size.width; pos.x += this.size.width;
}; };
......
...@@ -293,10 +293,12 @@ CDegreeBase.prototype.setDistance = function() ...@@ -293,10 +293,12 @@ CDegreeBase.prototype.setDistance = function()
else else
this.dW = 0.056*PlH; this.dW = 0.056*PlH;
}; };
CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CDegreeBase.prototype.setPosition = function(pos, PosInfo)
{ {
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
...@@ -326,13 +328,13 @@ CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -326,13 +328,13 @@ CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
if(!this.baseContent.IsJustDraw()) if(!this.baseContent.IsJustDraw())
PosBase.y += this.baseContent.size.ascent; PosBase.y += this.baseContent.size.ascent;
this.baseContent.setPosition(PosBase, PRSA, Line, Range, Page); this.baseContent.setPosition(PosBase, PosInfo);
var PosIter = new CMathPosition(); var PosIter = new CMathPosition();
PosIter.x = X + this.baseContent.size.width + this.dW; PosIter.x = X + this.baseContent.size.width + this.dW;
PosIter.y = Y + this.size.ascent + this.upIter + this.iterContent.size.ascent; PosIter.y = Y + this.size.ascent + this.upIter + this.iterContent.size.ascent;
this.iterContent.setPosition(PosIter, PRSA, Line, Range, Page); this.iterContent.setPosition(PosIter, PosInfo);
pos.x += this.size.width; pos.x += this.size.width;
} }
...@@ -343,7 +345,7 @@ CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -343,7 +345,7 @@ CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
Y = pos.y; Y = pos.y;
this.baseContent.setPosition(pos, PRSA, Line, Range, Page); this.baseContent.setPosition(pos, PosInfo);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange); var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var Lng = this.Content.length; var Lng = this.Content.length;
...@@ -354,7 +356,7 @@ CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -354,7 +356,7 @@ CDegreeBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
pos.y += this.upIter + this.iterContent.size.ascent; pos.y += this.upIter + this.iterContent.size.ascent;
this.iterContent.setPosition(pos, PRSA, Line, Range, Page); this.iterContent.setPosition(pos, PosInfo);
pos.x += this.BrGapRight; pos.x += this.BrGapRight;
} }
...@@ -467,8 +469,10 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur ...@@ -467,8 +469,10 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
} }
}; };
CDegree.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CDegree.prototype.setPosition = function(pos, PosInfo)
{ {
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
...@@ -479,11 +483,11 @@ CDegree.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -479,11 +483,11 @@ CDegree.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
if(this.bOneLine || EndPos == Len - 1) if(this.bOneLine || EndPos == Len - 1)
{ {
CDegree.superclass.setPosition.call(this, pos, PRSA, Line, Range, Page); CDegree.superclass.setPosition.call(this, pos, PosInfo);
} }
else else
{ {
CMathBase.prototype.setPosition.call(this, pos, PRSA, Line, Range, Page); CMathBase.prototype.setPosition.call(this, pos, PosInfo);
} }
}; };
...@@ -980,18 +984,20 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR ...@@ -980,18 +984,20 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR
this.Bounds.SetWidth(CurLine, CurRange, PRSC.Range.W - RangeW); this.Bounds.SetWidth(CurLine, CurRange, PRSC.Range.W - RangeW);
} }
}; };
CDegreeSubSup.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CDegreeSubSup.prototype.setPosition = function(pos, PosInfo)
{ {
if(this.bOneLine) if(this.bOneLine)
{ {
CDegreeSubSup.superclass.setPosition.call(this, pos, PRSA, Line, Range, Page); CDegreeSubSup.superclass.setPosition.call(this, pos, PosInfo);
} }
else else
{ {
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
if(CurLine == 0 && CurRange == 0) if(CurLine == 0 && CurRange == 0)
{ {
...@@ -1001,14 +1007,14 @@ CDegreeSubSup.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -1001,14 +1007,14 @@ CDegreeSubSup.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
var PosIters = new CMathPosition(); var PosIters = new CMathPosition();
if(this.Pr.type == DEGREE_SubSup) if(this.Pr.type == DEGREE_SubSup)
{ {
this.baseContent.setPosition(pos, PRSA, Line, Range, Page); this.baseContent.setPosition(pos, PosInfo);
if(this.baseContent.Math_Is_End(Line, Range)) if(this.baseContent.Math_Is_End(Line, Range))
{ {
PosIters.x = pos.x; PosIters.x = pos.x;
PosIters.y = pos.y - this.iters.size.ascent; PosIters.y = pos.y - this.iters.size.ascent;
this.iters.setPosition(PosIters, PRSA, Line, Range, Page); this.iters.setPosition(PosIters, PosInfo);
pos.x += this.iters.size.width + this.dW + this.BrGapRight; pos.x += this.iters.size.width + this.dW + this.BrGapRight;
} }
...@@ -1020,13 +1026,13 @@ CDegreeSubSup.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -1020,13 +1026,13 @@ CDegreeSubSup.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
PosIters.x = pos.x; PosIters.x = pos.x;
PosIters.y = pos.y - this.iters.size.ascent; PosIters.y = pos.y - this.iters.size.ascent;
this.iters.setPosition(PosIters, PRSA, Line, Range, Page); this.iters.setPosition(PosIters, PosInfo);
pos.x += this.iters.size.width + this.dW; pos.x += this.iters.size.width + this.dW;
} }
this.baseContent.setPosition(pos, PRSA, Line, Range, Page); this.baseContent.setPosition(pos, PosInfo);
if(this.baseContent.Math_Is_End(Line, Range)) if(this.baseContent.Math_Is_End(Line, Range))
pos.x += this.BrGapRight; pos.x += this.BrGapRight;
......
...@@ -388,11 +388,11 @@ CFraction.prototype.recalculateLinear = function() ...@@ -388,11 +388,11 @@ CFraction.prototype.recalculateLinear = function()
this.size.width = width; this.size.width = width;
this.size.ascent = ascent; this.size.ascent = ascent;
}; };
CFraction.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CFraction.prototype.setPosition = function(pos, PosInfo)
{ {
if(this.Pr.type == SKEWED_FRACTION) if(this.Pr.type == SKEWED_FRACTION)
{ {
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var Numerator = this.Content[0], var Numerator = this.Content[0],
Denominator = this.Content[1]; Denominator = this.Content[1];
...@@ -413,13 +413,15 @@ CFraction.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -413,13 +413,15 @@ CFraction.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); Numerator.setPosition(PosNum, PosInfo);
Denominator.setPosition(PosDen, PRSA, Line, Range, Page); Denominator.setPosition(PosDen, PosInfo);
pos.x += this.size.width; pos.x += this.size.width;
} }
else else
CFraction.superclass.setPosition.call(this, pos, PRSA, Line, Range, Page); {
CFraction.superclass.setPosition.call(this, pos, PosInfo);
}
}; };
CFraction.prototype.fillContent = function() CFraction.prototype.fillContent = function()
{ {
...@@ -545,7 +547,7 @@ CDenominator.prototype.recalculateSize = function() ...@@ -545,7 +547,7 @@ CDenominator.prototype.recalculateSize = function()
var mgCtrPrp = this.Get_TxtPrControlLetter(); var mgCtrPrp = this.Get_TxtPrControlLetter();
var Ascent = arg.ascent - 4.938888888888888*mgCtrPrp.FontSize/36; var Ascent = arg.ascent - 4.939*mgCtrPrp.FontSize/36;
g_oTextMeasurer.SetFont(mgCtrPrp); g_oTextMeasurer.SetFont(mgCtrPrp);
var Height = g_oTextMeasurer.GetHeight(); var Height = g_oTextMeasurer.GetHeight();
...@@ -575,10 +577,10 @@ CDenominator.prototype.recalculateSize = function() ...@@ -575,10 +577,10 @@ CDenominator.prototype.recalculateSize = function()
this.size.width = width; this.size.width = width;
this.size.ascent = ascent; this.size.ascent = ascent;
}; };
CDenominator.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CDenominator.prototype.setPosition = function(pos, PosInfo)
{ {
pos.y += this.gap; pos.y += this.gap;
CDenominator.superclass.setPosition.call(this, pos, PRSA, Line, Range, Page); CDenominator.superclass.setPosition.call(this, pos, PosInfo);
}; };
////////// //////////
...@@ -121,6 +121,13 @@ CInfoPoints.prototype.SetDefault = function() ...@@ -121,6 +121,13 @@ CInfoPoints.prototype.SetDefault = function()
this.ContentPoints.SetDefault(); this.ContentPoints.SetDefault();
}; };
function CMathPosInfo()
{
this.CurRange = -1;
this.CurLine = -1;
this.DispositionOpers = null;
}
function CMathPosition() function CMathPosition()
{ {
...@@ -999,10 +1006,28 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths ...@@ -999,10 +1006,28 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths
this.Bounds.SetWidth(0, 0, this.size.width); this.Bounds.SetWidth(0, 0, this.size.width);
}; };
CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CMathContent.prototype.UpdateBoundsPosInfo = function(PRSA, _CurLine, _CurRange, _CurPage)
{ {
this.pos.x = pos.x; var CurLine = _CurLine - this.StartLine;
this.pos.y = pos.y; var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
this.Bounds.SetGenPos(CurLine, CurRange, PRSA);
this.Bounds.SetPage(CurLine, CurRange, _CurPage);
for(var Pos = StartPos; Pos <= EndPos; Pos++)
{
if(this.Content[Pos].Type == para_Math_Composition)
this.Content[Pos].UpdateBoundsPosInfo(PRSA, _CurLine, _CurRange, _CurPage);
}
};
CMathContent.prototype.setPosition = function(pos, PosInfo)
{
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
...@@ -1016,19 +1041,19 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -1016,19 +1041,19 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
PosInfoEqq.SetInfoPoints(this.InfoPoints); PosInfoEqq.SetInfoPoints(this.InfoPoints);
pos.x += PosInfoEqq.GetAlign(); pos.x += PosInfoEqq.GetAlign();
this.pos.x = pos.x;
} }
this.Bounds.SetPos(CurLine, CurRange, this.pos, PRSA); this.pos.x = pos.x;
this.pos.y = pos.y;
this.Bounds.SetPage(CurLine, CurRange, Page); this.Bounds.SetPos(CurLine, CurRange, this.pos);
for(var i = StartPos; i <= EndPos; i++) for(var Pos = StartPos; Pos <= EndPos; Pos++)
{ {
if(this.Content[i].Type == para_Math_Run) if(this.Content[Pos].Type == para_Math_Run)
this.Content[i].Math_SetPosition(pos, PRSA, Line, Range, Page); this.Content[Pos].Math_SetPosition(pos, PosInfo);
else else
this.Content[i].setPosition(pos, PRSA, Line, Range, Page); this.Content[Pos].setPosition(pos, PosInfo);
} }
}; };
CMathContent.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange) CMathContent.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
...@@ -1051,7 +1076,7 @@ CMathContent.prototype.hidePlaceholder = function(flag) ...@@ -1051,7 +1076,7 @@ CMathContent.prototype.hidePlaceholder = function(flag)
this.plhHide = flag; this.plhHide = flag;
}; };
///////// RunPrp, CtrPrp ///////// RunPrp, CtrPrp
CMathContent.prototype.getFirstRPrp = function(ParaMath) CMathContent.prototype.getFirstRPrp = function()
{ {
return this.Content[0].Get_CompiledPr(true); return this.Content[0].Get_CompiledPr(true);
}; };
...@@ -3873,8 +3898,6 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -3873,8 +3898,6 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var bInternalOper = false, var bInternalOper = false,
bCurInsideOper = false; bCurInsideOper = false;
var BoxLen, BoxGapRight;
for(var Pos = RangeStartPos; Pos < ContentLen; Pos++) for(var Pos = RangeStartPos; Pos < ContentLen; Pos++)
{ {
var Item = this.Content[Pos], var Item = this.Content[Pos],
...@@ -3915,17 +3938,12 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -3915,17 +3938,12 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
} }
else else
{ {
BoxLen = Item.size.width; Item.Recalculate_Range(PRS, ParaPr, Depth + 1);
BoxGapRight = Item.GapRight;
var WWordLen = bOperBefore == true ? PRS.X + PRS.WordLen + PRS.SpaceLen : PRS.X + PRS.SpaceLen + PRS.WordLen + BoxLen - BoxGapRight; var WidthItem = Item.size.width,
GapRight = Item.GapRight;
if(WWordLen > PRS.XEnd) if(Item.kind == MATH_BOX)
{
PRS.NewRange = true;
PRS.MoveToLBP = true;
}
else if(Item.kind == MATH_BOX)
{ {
if(true == Item.IsBreak(bInline)) if(true == Item.IsBreak(bInline))
{ {
...@@ -3933,13 +3951,22 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -3933,13 +3951,22 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
} }
else else
{ {
PRS.WordLen += BoxLen; PRS.WordLen += WidthItem;
} }
} }
else
var WWordLen = bOperBefore == true ? PRS.X + PRS.WordLen + PRS.SpaceLen : PRS.X + PRS.SpaceLen + PRS.WordLen + WidthItem - GapRight;
if(PRS.NewRange == false && WWordLen > PRS.XEnd)
{ {
Item.Recalculate_Range(PRS, ParaPr, Depth + 1); PRS.NewRange = true;
PRS.MoveToLBP = true;
} }
/*else
{
Item.Recalculate_Range(PRS, ParaPr, Depth + 1);
}*/
} }
} }
else // контент может занимать несколько строк else // контент может занимать несколько строк
...@@ -3962,7 +3989,6 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -3962,7 +3989,6 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
// перед мат объектом идет box break_operator и он не является первым элементом в строке // перед мат объектом идет box break_operator и он не является первым элементом в строке
if(Item.kind == MATH_BOX) if(Item.kind == MATH_BOX)
{ {
BoxLen = Item.size.width;
if(true == Item.IsBreak(bInline)) if(true == Item.IsBreak(bInline))
{ {
...@@ -3975,7 +4001,7 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -3975,7 +4001,7 @@ CMathContent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
} }
else else
{ {
PRS.WordLen += BoxLen; PRS.WordLen += Item.size.width;
} }
PRS.MathFirstItem = false; PRS.MathFirstItem = false;
......
...@@ -464,7 +464,7 @@ CMathMatrix.prototype.init = function(props) ...@@ -464,7 +464,7 @@ CMathMatrix.prototype.init = function(props)
this.fillContent(); this.fillContent();
}; };
CMathMatrix.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CMathMatrix.prototype.setPosition = function(pos, PosInfo)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
...@@ -473,7 +473,7 @@ CMathMatrix.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -473,7 +473,7 @@ CMathMatrix.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
else else
this.pos.y = pos.y - this.size.ascent; ///!!!! this.pos.y = pos.y - this.size.ascent; ///!!!!
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var maxWH = this.getWidthsHeights(); var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths; var Widths = maxWH.widths;
...@@ -493,7 +493,7 @@ CMathMatrix.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -493,7 +493,7 @@ CMathMatrix.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); Item.setPosition(NewPos, PosInfo);
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];
...@@ -834,7 +834,7 @@ CEqArray.prototype.getMetrics = function() ...@@ -834,7 +834,7 @@ CEqArray.prototype.getMetrics = function()
return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics}; return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics};
}; };
CEqArray.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CEqArray.prototype.setPosition = function(pos, PosInfo)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
...@@ -843,7 +843,7 @@ CEqArray.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -843,7 +843,7 @@ CEqArray.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
else else
this.pos.y = pos.y - this.size.ascent; ///!!!! this.pos.y = pos.y - this.size.ascent; ///!!!!
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var maxWH = this.getWidthsHeights(); var maxWH = this.getWidthsHeights();
var Heights = maxWH.heights; var Heights = maxWH.heights;
...@@ -858,7 +858,7 @@ CEqArray.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -858,7 +858,7 @@ CEqArray.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); Item.setPosition(NewPos, PosInfo);
h += Heights[i] + this.gaps.row[i]; h += Heights[i] + this.gaps.row[i];
} }
......
...@@ -641,18 +641,20 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa ...@@ -641,18 +641,20 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
} }
} }
}; };
CNary.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CNary.prototype.setPosition = function(pos, PosInfo)
{ {
if(this.bOneLine) if(this.bOneLine)
{ {
CNary.superclass.setPosition.call(this, pos, PRSA, Line, Range, Page); CNary.superclass.setPosition.call(this, pos, PosInfo);
} }
else else
{ {
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range ); var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range );
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
if(CurLine == 0 && CurRange == 0) if(CurLine == 0 && CurRange == 0)
{ {
...@@ -662,12 +664,12 @@ CNary.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -662,12 +664,12 @@ CNary.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
PosBase.x = pos.x; PosBase.x = pos.x;
PosBase.y = pos.y - this.Base.size.ascent; PosBase.y = pos.y - this.Base.size.ascent;
this.Base.setPosition(PosBase, PRSA, Line, Range, Page); this.Base.setPosition(PosBase, PosInfo);
pos.x += this.Base.size.width + this.dW; pos.x += this.Base.size.width + this.dW;
} }
this.Arg.setPosition(pos, PRSA, Line, Range, Page); this.Arg.setPosition(pos, PosInfo);
if(this.Arg.Math_Is_End(Line, Range)) if(this.Arg.Math_Is_End(Line, Range))
{ {
...@@ -837,7 +839,7 @@ CNaryUndOvr.prototype.recalculateSize = function() ...@@ -837,7 +839,7 @@ CNaryUndOvr.prototype.recalculateSize = function()
this.size.width = width; this.size.width = width;
this.size.ascent = ascent; this.size.ascent = ascent;
}; };
CNaryUndOvr.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CNaryUndOvr.prototype.setPosition = function(pos, PosInfo)
{ {
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y; this.pos.y = pos.y;
...@@ -863,9 +865,9 @@ CNaryUndOvr.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -863,9 +865,9 @@ CNaryUndOvr.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); UpIter.setPosition(PosUpIter, PosInfo);
Sign.setPosition(PosSign, PRSA, Line, Range, Page); Sign.setPosition(PosSign, PosInfo);
LowIter.setPosition(PosLowIter, PRSA, Line, Range, Page); LowIter.setPosition(PosLowIter, PosInfo);
}; };
CNaryUndOvr.prototype.setBase = function(base) CNaryUndOvr.prototype.setBase = function(base)
{ {
......
...@@ -3558,9 +3558,11 @@ CDelimiter.prototype.GetAscentOperator = function(operator) // в качеств ...@@ -3558,9 +3558,11 @@ CDelimiter.prototype.GetAscentOperator = function(operator) // в качеств
return Ascent; return Ascent;
}; };
CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CDelimiter.prototype.setPosition = function(pos, PosInfo)
{ {
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var Line = PosInfo.CurLine,
Range = PosInfo.CurRange;
if(this.bOneLine == false) if(this.bOneLine == false)
{ {
...@@ -3574,7 +3576,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -3574,7 +3576,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
this.UpdatePosOperBeg(pos, Line); this.UpdatePosOperBeg(pos, Line);
} }
this.Content[0].setPosition(pos, PRSA, Line, Range, Page); this.Content[0].setPosition(pos, PosInfo);
// пересчет еще не закончился, поэтому на LastRange не можем проверить // пересчет еще не закончился, поэтому на LastRange не можем проверить
if(true === this.Content[0].Math_Is_End(Line, Range)) if(true === this.Content[0].Math_Is_End(Line, Range))
...@@ -3596,7 +3598,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -3596,7 +3598,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
this.UpdatePosOperBeg(CurrPos, Line); this.UpdatePosOperBeg(CurrPos, Line);
this.Content[0].setPosition(CurrPos, PRSA, Line, Range, Page); // CMathContent this.Content[0].setPosition(CurrPos, PosInfo); // CMathContent
var PosSep = new CMathPosition(); var PosSep = new CMathPosition();
PosSep.x = CurrPos.x; PosSep.x = CurrPos.x;
...@@ -3609,7 +3611,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -3609,7 +3611,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
{ {
CurrPos.x += this.sepOper.size.width; CurrPos.x += this.sepOper.size.width;
this.Content[j].setPosition(CurrPos, PRSA, Line, Range, Page); this.Content[j].setPosition(CurrPos, PosInfo);
pos.x += this.Content[j].size.width; pos.x += this.Content[j].size.width;
} }
...@@ -3761,12 +3763,12 @@ CCharacter.prototype.recalculateSize = function(oMeasure) ...@@ -3761,12 +3763,12 @@ CCharacter.prototype.recalculateSize = function(oMeasure)
this.size.width = width; this.size.width = width;
this.size.ascent = ascent; this.size.ascent = ascent;
}; };
CCharacter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CCharacter.prototype.setPosition = function(pos, PosInfo)
{ {
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;
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var width = this.size.width - this.GapLeft - this.GapRight; var width = this.size.width - this.GapLeft - this.GapRight;
...@@ -3788,14 +3790,14 @@ CCharacter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -3788,14 +3790,14 @@ CCharacter.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); Base.setPosition(PosBase, PosInfo);
} }
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, PRSA, Line, Range, Page); Base.setPosition(PosBase, PosInfo);
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;
......
...@@ -585,12 +585,12 @@ CRadical.prototype.Resize = function(oMeasure, RPI) ...@@ -585,12 +585,12 @@ CRadical.prototype.Resize = function(oMeasure, RPI)
this.recalculateSize(oMeasure); this.recalculateSize(oMeasure);
}; };
CRadical.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CRadical.prototype.setPosition = function(pos, PosInfo)
{ {
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;
this.UpdatePosBound(pos, PRSA, Line, Range, Page); this.UpdatePosBound(pos, PosInfo);
var PosBase = new CMathPosition(), var PosBase = new CMathPosition(),
PosRadical = new CMathPosition(); PosRadical = new CMathPosition();
...@@ -607,7 +607,7 @@ CRadical.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -607,7 +607,7 @@ CRadical.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); this.RealBase.setPosition(PosBase, PosInfo);
} }
else if(this.Pr.type == DEGREE_RADICAL) else if(this.Pr.type == DEGREE_RADICAL)
{ {
...@@ -618,7 +618,7 @@ CRadical.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -618,7 +618,7 @@ CRadical.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); this.Iterator.setPosition(PosDegree, PosInfo);
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, PRSA, Line, Range, Page) ...@@ -630,7 +630,7 @@ CRadical.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
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, PRSA, Line, Range, Page); this.RealBase.setPosition(PosBase, PosInfo);
} }
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