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

1. Поправила реализацию Bounds для контентов: теперь учитывается разбивка формулы на Range

2. Поправила баг на поиске(Get_ParaContentPosByXY): осуществлялся поиск по всем контентам формулы, а не только тем, которые находились в конкретных CurLine и CurRange

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@63347 954022d7-b5bf-4e40-9824-e11837661b57
parent 877f5d18
...@@ -1285,7 +1285,6 @@ ParaMath.prototype.private_InitWrapSettings = function(PRS) ...@@ -1285,7 +1285,6 @@ ParaMath.prototype.private_InitWrapSettings = function(PRS)
XStart = _XStart; XStart = _XStart;
XEnd = _XEnd; XEnd = _XEnd;
IndexRange = Pos+1; IndexRange = Pos+1;
} }
} }
} }
...@@ -1536,12 +1535,6 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange ...@@ -1536,12 +1535,6 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
var pos = new CMathPosition(); var pos = new CMathPosition();
if(false == this.Root.IsStartRange(_CurLine, _CurRange))
{
var LinePos = this.Root.GetPos(_CurLine);
pos.x += PRSA.X - LinePos.x;
}
this.Root.setPosition(pos, 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);
...@@ -1996,13 +1989,13 @@ ParaMath.prototype.Draw_HighLights = function(PDSH) ...@@ -1996,13 +1989,13 @@ ParaMath.prototype.Draw_HighLights = function(PDSH)
var CommentId = ( CommentsCount > 0 ? PDSH.Comments[CommentsCount - 1] : null ); var CommentId = ( CommentsCount > 0 ? PDSH.Comments[CommentsCount - 1] : null );
var CommentsFlag = PDSH.CommentsFlag; var CommentsFlag = PDSH.CommentsFlag;
var Bounds = this.Root.Get_LineBound(PDSH.Line); var Bounds = this.Root.Get_LineBound(PDSH.Line, PDSH.Range);
Comm.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, 0, 0, 0, { Active : CommentsFlag === comments_ActiveComment ? true : false, CommentId : CommentId } ); Comm.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, 0, 0, 0, { Active : CommentsFlag === comments_ActiveComment ? true : false, CommentId : CommentId } );
} }
if (null !== CollFirst) if (null !== CollFirst)
{ {
var Bounds = this.Root.Get_LineBound(PDSH.Line); var Bounds = this.Root.Get_LineBound(PDSH.Line, PDSH.Range);
Coll.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, CollFirst.r, CollFirst.g, CollFirst.b); Coll.Add(Bounds.Y, Bounds.Y + Bounds.H, Bounds.X, Bounds.X + Bounds.W, 0, CollFirst.r, CollFirst.g, CollFirst.b);
} }
...@@ -2020,14 +2013,14 @@ ParaMath.prototype.Draw_Elements = function(PDSE) ...@@ -2020,14 +2013,14 @@ ParaMath.prototype.Draw_Elements = function(PDSE)
this.Root.Draw_Elements(PDSE); this.Root.Draw_Elements(PDSE);
PDSE.X = X + this.Root.Get_LineBound(PDSE.Line).W; PDSE.X = X + this.Root.GetWidth(PDSE.Line, PDSE.Range);
/*PDSE.Graphics.p_color(255,0,0, 255); /*PDSE.Graphics.p_color(255,0,0, 255);
PDSE.Graphics.drawHorLine(0, PDSE.Y - this.Ascent + this.Height, PDSE.X - 30, PDSE.X + this.Width + 30 , 1);*/ PDSE.Graphics.drawHorLine(0, PDSE.Y - this.Ascent + this.Height, PDSE.X - 30, PDSE.X + this.Width + 30 , 1);*/
}; };
ParaMath.prototype.GetLinePosition = function(Line) ParaMath.prototype.GetLinePosition = function(Line, Range)
{ {
return this.Root.GetPos(Line); return this.Root.GetPos(Line, Range);
}; };
ParaMath.prototype.Draw_Lines = function(PDSL) ParaMath.prototype.Draw_Lines = function(PDSL)
{ {
...@@ -2072,7 +2065,7 @@ ParaMath.prototype.Draw_Lines = function(PDSL) ...@@ -2072,7 +2065,7 @@ ParaMath.prototype.Draw_Lines = function(PDSL)
} }
} }
var Bound = this.Root.Get_LineBound(PDSL.Line), var Bound = this.Root.Get_LineBound(PDSL.Line, PDSL.Range),
Width = Bound.W; Width = Bound.W;
if ( true === FirstRPrp.Underline ) if ( true === FirstRPrp.Underline )
...@@ -2128,6 +2121,7 @@ ParaMath.prototype.Cursor_MoveToEndPos = function(SelectFromEnd) ...@@ -2128,6 +2121,7 @@ ParaMath.prototype.Cursor_MoveToEndPos = function(SelectFromEnd)
ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
{ {
var Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd); var Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
if(SearchPos.InText) if(SearchPos.InText)
...@@ -2350,8 +2344,21 @@ ParaMath.prototype.Get_ContentSelection = function() ...@@ -2350,8 +2344,21 @@ ParaMath.prototype.Get_ContentSelection = function()
if (oContent.bRoot) if (oContent.bRoot)
return null; return null;
var Bounds = oContent.Get_Bounds(); //
return Bounds;
//var Bounds = oContent.Get_Bounds();
//return Bounds;
var ContentBounds = oContent.Get_Bounds();
var ParaMathBounds = [];
for(var i = 0; i < ContentBounds.length; i++)
{
ParaMathBounds[i] = ContentBounds[i][0];
}
return ParaMathBounds;
}; };
ParaMath.prototype.Recalc_RunsCompiledPr = function() ParaMath.prototype.Recalc_RunsCompiledPr = function()
...@@ -2493,7 +2500,20 @@ ParaMath.prototype.Get_Bounds = function() ...@@ -2493,7 +2500,20 @@ ParaMath.prototype.Get_Bounds = function()
if (undefined === this.Paragraph || null === this.Paragraph) if (undefined === this.Paragraph || null === this.Paragraph)
return [{X : 0, Y : 0, W : 0, H : 0, Page : 0}]; return [{X : 0, Y : 0, W : 0, H : 0, Page : 0}];
else else
return this.Root.Get_Bounds(); {
//return this.Root.Get_Bounds();
var RootBounds = this.Root.Get_Bounds();
var ParaMathBounds = [];
for(var i = 0; i < RootBounds.length; i++)
{
ParaMathBounds[i] =/* RootBounds[i].length == 1 ? */RootBounds[i][0] /*: RootBounds[i][1]*/;
}
return ParaMathBounds;
}
}; };
ParaMath.prototype.getPropsForWrite = function() ParaMath.prototype.getPropsForWrite = function()
......
...@@ -1030,8 +1030,9 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu ...@@ -1030,8 +1030,9 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu
Pos = _EndPos; Pos = _EndPos;
var LocParaMath = this.ParaMath.GetLinePosition(_CurLine); var LocParaMath = this.ParaMath.GetLinePosition(_CurLine, _CurRange);
X = LocParaMath.x; X = LocParaMath.x;
Y = LocParaMath.y;
var MATH_Y = Y; var MATH_Y = Y;
var loc; var loc;
...@@ -4155,7 +4156,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE) ...@@ -4155,7 +4156,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE)
case para_Math_BreakOperator: case para_Math_BreakOperator:
case para_Math_Placeholder: case para_Math_Placeholder:
{ {
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
Item.Draw(PosLine.x, PosLine.y, pGraphics, InfoMathText); Item.Draw(PosLine.x, PosLine.y, pGraphics, InfoMathText);
X += Item.Get_WidthVisible(); X += Item.Get_WidthVisible();
break; break;
...@@ -4505,7 +4506,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, ...@@ -4505,7 +4506,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
if(this.Type == para_Math_Run) if(this.Type == para_Math_Run)
{ {
var PosLine = this.ParaMath.GetLinePosition(_CurLine); var PosLine = this.ParaMath.GetLinePosition(_CurLine, _CurRange);
var loc = this.Content[CurPos].GetLocationOfLetter(); var loc = this.Content[CurPos].GetLocationOfLetter();
SearchPos.CurX = PosLine.x + loc.x; // позиция формулы в строке + смещение буквы в контенте SearchPos.CurX = PosLine.x + loc.x; // позиция формулы в строке + смещение буквы в контенте
} }
...@@ -4565,7 +4566,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, ...@@ -4565,7 +4566,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
//для пустых Run искомая позиция - позиция самого Run //для пустых Run искомая позиция - позиция самого Run
var bEmpty = this.Is_Empty(); var bEmpty = this.Is_Empty();
var PosLine = this.ParaMath.GetLinePosition(_CurLine); var PosLine = this.ParaMath.GetLinePosition(_CurLine, _CurRange);
if(bEmpty) if(bEmpty)
SearchPos.CurX = PosLine.x + this.pos.x; SearchPos.CurX = PosLine.x + this.pos.x;
......
...@@ -604,7 +604,7 @@ CAccent.prototype.Draw_Elements = function(PDSE) ...@@ -604,7 +604,7 @@ CAccent.prototype.Draw_Elements = function(PDSE)
var oBase = this.Content[0]; var oBase = this.Content[0];
oBase.Draw_Elements(PDSE); oBase.Draw_Elements(PDSE);
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
var x = PosLine.x, var x = PosLine.x,
y = PosLine.y; y = PosLine.y;
......
This diff is collapsed.
...@@ -214,7 +214,7 @@ CBorderBox.prototype.Draw_Elements = function(PDSE) ...@@ -214,7 +214,7 @@ CBorderBox.prototype.Draw_Elements = function(PDSE)
var Width = this.size.width - this.GapLeft - this.GapRight, var Width = this.size.width - this.GapLeft - this.GapRight,
Height = this.size.height; Height = this.size.height;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
var X = this.pos.x + PosLine.x + this.GapLeft, var X = this.pos.x + PosLine.x + this.GapLeft,
Y = this.pos.y + PosLine.y; Y = this.pos.y + PosLine.y;
......
...@@ -102,7 +102,7 @@ CDegreeBase.prototype.recalculateSize = function(oMeasure) ...@@ -102,7 +102,7 @@ CDegreeBase.prototype.recalculateSize = function(oMeasure)
{ {
var Metric = new CMathBoundsMeasures(); var Metric = new CMathBoundsMeasures();
Metric.UpdateMetrics(this.baseContent.size); Metric.UpdateMetrics(this.baseContent.size);
Metric.UpdateWidth(this.baseContent.size.width); Metric.SetWidth(this.baseContent.size.width);
this.setDistance(); this.setDistance();
...@@ -437,7 +437,7 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur ...@@ -437,7 +437,7 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
this.iterContent.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics); this.iterContent.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
this.baseContent.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics); this.baseContent.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
var BoundBase = this.baseContent.Get_LineBound(_CurLine); var BoundBase = this.baseContent.Get_LineBound(_CurLine, _CurRange);
var Bound; var Bound;
if(this.Pr.type === DEGREE_SUPERSCRIPT) if(this.Pr.type === DEGREE_SUPERSCRIPT)
...@@ -449,7 +449,7 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur ...@@ -449,7 +449,7 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
Bound = this.GetSizeSubScript(g_oTextMeasurer, BoundBase); Bound = this.GetSizeSubScript(g_oTextMeasurer, BoundBase);
} }
this.Bounds.UpdateMetrics(CurLine, Bound); this.Bounds.UpdateMetrics(CurLine, CurRange, Bound);
ContentMetrics.UpdateMetrics(Bound); ContentMetrics.UpdateMetrics(Bound);
this.UpdatePRS(PRS, Bound); this.UpdatePRS(PRS, Bound);
...@@ -646,7 +646,7 @@ CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure) ...@@ -646,7 +646,7 @@ CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure)
{ {
var Metric = new CMathBoundsMeasures(); var Metric = new CMathBoundsMeasures();
Metric.UpdateMetrics(this.baseContent.size); Metric.UpdateMetrics(this.baseContent.size);
Metric.UpdateWidth(this.baseContent.size.width); Metric.SetWidth(this.baseContent.size.width);
var ResultSize = this.GetSize(oMeasure, Metric); var ResultSize = this.GetSize(oMeasure, Metric);
...@@ -845,14 +845,14 @@ CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine ...@@ -845,14 +845,14 @@ CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine
// основание, baseContent // основание, baseContent
this.Content[0].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics); this.Content[0].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
var BoundBase = this.baseContent.Get_LineBound(_CurLine); var BoundBase = this.baseContent.Get_LineBound(_CurLine, _CurRange);
var Bound = this.GetSize(g_oTextMeasurer, BoundBase); var Bound = this.GetSize(g_oTextMeasurer, BoundBase);
this.Bounds.UpdateMetrics(CurLine, Bound); this.Bounds.UpdateMetrics(CurLine, CurRange, Bound);
ContentMetrics.UpdateMetrics(Bound); ContentMetrics.UpdateMetrics(Bound);
this.iters.Bounds.Reset(); this.iters.Bounds.Reset();
this.iters.Bounds.UpdateMetrics(0, this.iters.size); this.iters.Bounds.UpdateMetrics(0, 0, this.iters.size);
this.UpdatePRS(PRS, Bound); this.UpdatePRS(PRS, Bound);
} }
...@@ -930,7 +930,6 @@ CDegreeSubSup.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -930,7 +930,6 @@ CDegreeSubSup.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos); this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos);
} }
}; };
CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange) CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
...@@ -961,7 +960,7 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR ...@@ -961,7 +960,7 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR
this.iters.iterUp.Recalculate_Range_Width(PRSC, _CurLine, _CurRange); this.iters.iterUp.Recalculate_Range_Width(PRSC, _CurLine, _CurRange);
this.iters.iterDn.Recalculate_Range_Width(PRSC, _CurLine, _CurRange); this.iters.iterDn.Recalculate_Range_Width(PRSC, _CurLine, _CurRange);
this.iters.Bounds.SetWidth(0, this.iters.size.width); this.iters.Bounds.SetWidth(0, 0, this.iters.size.width);
PRSC.Range.W = RangeW2 + this.iters.size.width + this.dW; PRSC.Range.W = RangeW2 + this.iters.size.width + this.dW;
} }
...@@ -974,7 +973,7 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR ...@@ -974,7 +973,7 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR
PRSC.Range.W += this.BrGapRight; PRSC.Range.W += this.BrGapRight;
} }
this.Bounds.SetWidth(CurLine, 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, PRSA, Line, Range, Page)
......
...@@ -92,7 +92,7 @@ CFraction.prototype.drawBarFraction = function(PDSE) ...@@ -92,7 +92,7 @@ CFraction.prototype.drawBarFraction = function(PDSE)
var width = this.size.width - this.GapLeft - this.GapRight; var width = this.size.width - this.GapLeft - this.GapRight;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
var x1 = this.pos.x + PosLine.x + this.GapLeft, var x1 = this.pos.x + PosLine.x + this.GapLeft,
x2 = this.pos.x + PosLine.x + this.GapLeft + width, x2 = this.pos.x + PosLine.x + this.GapLeft + width,
...@@ -125,7 +125,7 @@ CFraction.prototype.drawSkewedFraction = function(PDSE) ...@@ -125,7 +125,7 @@ CFraction.prototype.drawSkewedFraction = function(PDSE)
var tg1 = -2.22, var tg1 = -2.22,
tg2 = -3.7; tg2 = -3.7;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
var X = this.pos.x + PosLine.x + this.GapLeft, var X = this.pos.x + PosLine.x + this.GapLeft,
Y = this.pos.y + PosLine.y; Y = this.pos.y + PosLine.y;
...@@ -208,7 +208,7 @@ CFraction.prototype.drawLinearFraction = function(PDSE) ...@@ -208,7 +208,7 @@ CFraction.prototype.drawLinearFraction = function(PDSE)
{ {
var shift = 0.1*this.dW; var shift = 0.1*this.dW;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
var X = this.pos.x + PosLine.x + this.GapLeft, var X = this.pos.x + PosLine.x + this.GapLeft,
Y = this.pos.y + PosLine.y; Y = this.pos.y + PosLine.y;
......
...@@ -991,7 +991,7 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths ...@@ -991,7 +991,7 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths
this.size.width += this.Content[i].size.width; this.size.width += this.Content[i].size.width;
} }
this.Bounds.SetWidth(0, this.size.width); this.Bounds.SetWidth(0, 0, this.size.width);
}; };
CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
{ {
...@@ -1013,10 +1013,9 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -1013,10 +1013,9 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
this.pos.x = pos.x; this.pos.x = pos.x;
} }
if(this.IsStartRange(Line, Range)) this.Bounds.SetPos(CurLine, CurRange, this.pos, PRSA);
this.Bounds.SetPos(CurLine, this.pos, PRSA);
this.Bounds.SetPage(CurLine, Page); this.Bounds.SetPage(CurLine, CurRange, Page);
for(var i = StartPos; i <= EndPos; i++) for(var i = StartPos; i <= EndPos; i++)
{ {
...@@ -1031,7 +1030,7 @@ CMathContent.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange) ...@@ -1031,7 +1030,7 @@ CMathContent.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange ); var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
this.Bounds.ShiftPos(CurLine, Dx, Dy); this.Bounds.ShiftPos(CurLine, CurRange, Dx, Dy);
CMathContent.superclass.Shift_Range.call(this, Dx, Dy, _CurLine, _CurRange); CMathContent.superclass.Shift_Range.call(this, Dx, Dy, _CurLine, _CurRange);
}; };
...@@ -3576,7 +3575,7 @@ CMathContent.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth) ...@@ -3576,7 +3575,7 @@ CMathContent.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth)
}; };
CMathContent.prototype.Draw_HighLights = function(PDSH, bAll) CMathContent.prototype.Draw_HighLights = function(PDSH, bAll)
{ {
var Bound = this.Get_LineBound(PDSH.Line); var Bound = this.Get_LineBound(PDSH.Line, PDSH.Range);
PDSH.X = Bound.X; PDSH.X = Bound.X;
var CurLine = PDSH.Line - this.StartLine; var CurLine = PDSH.Line - this.StartLine;
...@@ -3615,7 +3614,7 @@ CMathContent.prototype.Draw_Lines = function(PDSL) ...@@ -3615,7 +3614,7 @@ CMathContent.prototype.Draw_Lines = function(PDSL)
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);
var Bound = this.Get_LineBound(PDSL.Line); var Bound = this.Get_LineBound(PDSL.Line, PDSL.Range);
var Baseline = Bound.Y + Bound.Asc; var Baseline = Bound.Y + Bound.Asc;
...@@ -3726,7 +3725,7 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec ...@@ -3726,7 +3725,7 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec
if(this.bRoot == false) if(this.bRoot == false)
{ {
var Bound = this.Get_LineBound(_CurLine); var Bound = this.Get_LineBound(_CurLine, _CurRange);
SelectionDraw.StartY = Bound.Y; SelectionDraw.StartY = Bound.Y;
SelectionDraw.H = Bound.H; SelectionDraw.H = Bound.H;
} }
...@@ -3740,7 +3739,7 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec ...@@ -3740,7 +3739,7 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec
if(Item.Type == para_Math_Composition && bSelectAll) if(Item.Type == para_Math_Composition && bSelectAll)
{ {
SelectionDraw.FindStart = false; SelectionDraw.FindStart = false;
SelectionDraw.W += Item.Get_Width(_CurLine); SelectionDraw.W += Item.Get_Width(_CurLine, _CurRange);
} }
else else
{ {
...@@ -4137,7 +4136,7 @@ CMathContent.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRa ...@@ -4137,7 +4136,7 @@ CMathContent.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRa
this.Content[CurPos].Recalculate_Range_Width( PRSC, _CurLine, _CurRange ); this.Content[CurPos].Recalculate_Range_Width( PRSC, _CurLine, _CurRange );
} }
this.Bounds.SetWidth(CurLine, PRSC.Range.W - RangeW); this.Bounds.SetWidth(CurLine, CurRange, PRSC.Range.W - RangeW);
}; };
CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics) CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{ {
...@@ -4160,7 +4159,7 @@ CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, ...@@ -4160,7 +4159,7 @@ CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine,
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics); Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
} }
this.Bounds.UpdateMetrics(CurLine, NewContentMetrics); this.Bounds.UpdateMetrics(CurLine, CurRange, NewContentMetrics);
ContentMetrics.UpdateMetrics(NewContentMetrics); ContentMetrics.UpdateMetrics(NewContentMetrics);
}; };
...@@ -4184,25 +4183,31 @@ CMathContent.prototype.Get_Bounds = function() ...@@ -4184,25 +4183,31 @@ CMathContent.prototype.Get_Bounds = function()
{ {
return this.Bounds.Get_Bounds(); return this.Bounds.Get_Bounds();
}; };
CMathContent.prototype.Get_LineBound = function(_CurLine) CMathContent.prototype.Get_LineBound = function(_CurLine, _CurRange)
{ {
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.StartLine,
return this.Bounds.Get_LineBound(CurLine); CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
return this.Bounds.Get_LineBound(CurLine, CurRange);
}; };
CMathContent.prototype.SetPage = function(Line, Page) /*CMathContent.prototype.SetPage = function(Line, Page)
{ {
var CurLine = Line - this.StartLine; var CurLine = Line - this.StartLine;
this.Bounds.SetPage(CurLine, Page); this.Bounds.SetPage(CurLine, Page);
}; };*/
CMathContent.prototype.GetPos = function(Line) CMathContent.prototype.GetPos = function(_CurLine, _CurRange)
{ {
var CurLine = Line - this.StartLine; var CurLine = _CurLine - this.StartLine,
return this.Bounds.GetPos(CurLine); CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
return this.Bounds.GetPos(CurLine, CurRange);
}; };
CMathContent.prototype.GetWidth = function(Line) CMathContent.prototype.GetWidth = function(_CurLine, _CurRange)
{ {
var CurLine = Line - this.StartLine; var CurLine = _CurLine - this.StartLine,
return this.Bounds.GetWidth(CurLine); CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
return this.Bounds.GetWidth(CurLine, CurRange);
}; };
CMathContent.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth) CMathContent.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{ {
......
...@@ -132,7 +132,7 @@ CMathBaseText.prototype.Can_AddNumbering = function() ...@@ -132,7 +132,7 @@ CMathBaseText.prototype.Can_AddNumbering = function()
}; };
CMathBaseText.prototype.Draw_Elements = function(PDSE) // эта функция необходима для Draw_Elements основания Nary, когда в основании находится только JustDraw элемент CMathBaseText.prototype.Draw_Elements = function(PDSE) // эта функция необходима для Draw_Elements основания Nary, когда в основании находится только JustDraw элемент
{ {
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
this.Draw(PosLine.x, PosLine.y, PDSE.Graphics); this.Draw(PosLine.x, PosLine.y, PDSE.Graphics);
}; };
......
...@@ -550,7 +550,7 @@ CNary.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange) ...@@ -550,7 +550,7 @@ CNary.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
this.LowerIterator.Recalculate_Range_Width(PRSC, _CurLine, _CurRange); this.LowerIterator.Recalculate_Range_Width(PRSC, _CurLine, _CurRange);
this.UpperIterator.Recalculate_Range_Width(PRSC, _CurLine, _CurRange); this.UpperIterator.Recalculate_Range_Width(PRSC, _CurLine, _CurRange);
this.Base.Bounds.SetWidth(CurLine, this.Base.size.width); this.Base.Bounds.SetWidth(CurLine, CurRange, this.Base.size.width);
} }
PRSC.Range.W = RangeW2 + this.Base.size.width + this.dW; PRSC.Range.W = RangeW2 + this.Base.size.width + this.dW;
...@@ -564,7 +564,7 @@ CNary.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange) ...@@ -564,7 +564,7 @@ CNary.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
PRSC.Range.W += this.BrGapRight; PRSC.Range.W += this.BrGapRight;
} }
this.Bounds.SetWidth(CurLine, PRSC.Range.W - RangeW); this.Bounds.SetWidth(CurLine, CurRange, PRSC.Range.W - RangeW);
} }
}; };
CNary.prototype.Draw_Elements = function(PDSE) CNary.prototype.Draw_Elements = function(PDSE)
...@@ -609,9 +609,9 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa ...@@ -609,9 +609,9 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
this.Arg.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics); this.Arg.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
var BoundArg = this.Arg.Get_LineBound(_CurLine); var BoundArg = this.Arg.Get_LineBound(_CurLine, _CurRange);
this.Bounds.UpdateMetrics(CurLine, BoundArg); this.Bounds.UpdateMetrics(CurLine, CurRange, BoundArg);
this.UpdatePRS(PRS, BoundArg); this.UpdatePRS(PRS, BoundArg);
...@@ -622,7 +622,7 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa ...@@ -622,7 +622,7 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
if(this.Base.IsJustDraw()) if(this.Base.IsJustDraw())
{ {
this.Bounds.UpdateMetrics(CurLine, this.Base.size); this.Bounds.UpdateMetrics(CurLine, CurRange, this.Base.size);
ContentMetrics.UpdateMetrics(this.Base.size); ContentMetrics.UpdateMetrics(this.Base.size);
this.UpdatePRS(PRS, this.Base.size); this.UpdatePRS(PRS, this.Base.size);
} }
...@@ -637,7 +637,7 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa ...@@ -637,7 +637,7 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
this.Base.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics); this.Base.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
this.Bounds.UpdateMetrics(CurLine, this.Base.size); this.Bounds.UpdateMetrics(CurLine, CurRange, this.Base.size);
this.UpdatePRS(PRS, this.Base.size); this.UpdatePRS(PRS, this.Base.size);
} }
...@@ -904,7 +904,7 @@ CNaryOperator.prototype.Draw_Elements = function(PDSE) ...@@ -904,7 +904,7 @@ CNaryOperator.prototype.Draw_Elements = function(PDSE)
{ {
this.Parent.Make_ShdColor(PDSE, this.Parent.Get_CompiledCtrPrp()); this.Parent.Make_ShdColor(PDSE, this.Parent.Get_CompiledCtrPrp());
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
if(this.Type == para_Math_Text) if(this.Type == para_Math_Text)
this.drawTextElem(PosLine.x, PosLine.y, PDSE.Graphics); this.drawTextElem(PosLine.x, PosLine.y, PDSE.Graphics);
......
...@@ -3749,7 +3749,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -3749,7 +3749,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
}; };
CDelimiter.prototype.Draw_Elements = function(PDSE) CDelimiter.prototype.Draw_Elements = function(PDSE)
{ {
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
if(this.bOneLine == false) if(this.bOneLine == false)
{ {
...@@ -3958,7 +3958,7 @@ CCharacter.prototype.Draw_Elements = function(PDSE) ...@@ -3958,7 +3958,7 @@ CCharacter.prototype.Draw_Elements = function(PDSE)
PDSE.Graphics.SetFont(Font); PDSE.Graphics.SetFont(Font);
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
this.operator.draw(PosLine.x, PosLine.y, PDSE.Graphics, PDSE); this.operator.draw(PosLine.x, PosLine.y, PDSE.Graphics, PDSE);
......
...@@ -644,7 +644,7 @@ CRadical.prototype.Draw_Elements = function(PDSE) ...@@ -644,7 +644,7 @@ CRadical.prototype.Draw_Elements = function(PDSE)
{ {
var X = PDSE.X; var X = PDSE.X;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line); var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
this.signRadical.draw(PosLine.x, PosLine.y, PDSE.Graphics, PDSE); this.signRadical.draw(PosLine.x, PosLine.y, PDSE.Graphics, PDSE);
CRadical.superclass.Draw_Elements.call(this, PDSE); CRadical.superclass.Draw_Elements.call(this, PDSE);
......
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