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)
XStart = _XStart;
XEnd = _XEnd;
IndexRange = Pos+1;
}
}
}
......@@ -1536,12 +1535,6 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
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.Recalculate_Range_Spaces(PRSA, _CurLine, _CurRange, Page + _CurPage);
......@@ -1996,13 +1989,13 @@ ParaMath.prototype.Draw_HighLights = function(PDSH)
var CommentId = ( CommentsCount > 0 ? PDSH.Comments[CommentsCount - 1] : null );
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 } );
}
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);
}
......@@ -2020,14 +2013,14 @@ ParaMath.prototype.Draw_Elements = function(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.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)
{
......@@ -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;
if ( true === FirstRPrp.Underline )
......@@ -2128,6 +2121,7 @@ ParaMath.prototype.Cursor_MoveToEndPos = function(SelectFromEnd)
ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
{
var Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
if(SearchPos.InText)
......@@ -2350,8 +2344,21 @@ ParaMath.prototype.Get_ContentSelection = function()
if (oContent.bRoot)
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()
......@@ -2493,7 +2500,20 @@ ParaMath.prototype.Get_Bounds = function()
if (undefined === this.Paragraph || null === this.Paragraph)
return [{X : 0, Y : 0, W : 0, H : 0, Page : 0}];
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()
......
......@@ -1030,8 +1030,9 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu
Pos = _EndPos;
var LocParaMath = this.ParaMath.GetLinePosition(_CurLine);
var LocParaMath = this.ParaMath.GetLinePosition(_CurLine, _CurRange);
X = LocParaMath.x;
Y = LocParaMath.y;
var MATH_Y = Y;
var loc;
......@@ -4155,7 +4156,7 @@ ParaRun.prototype.Draw_Elements = function(PDSE)
case para_Math_BreakOperator:
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);
X += Item.Get_WidthVisible();
break;
......@@ -4505,7 +4506,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
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();
SearchPos.CurX = PosLine.x + loc.x; // позиция формулы в строке + смещение буквы в контенте
}
......@@ -4565,7 +4566,7 @@ ParaRun.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
//для пустых Run искомая позиция - позиция самого Run
var bEmpty = this.Is_Empty();
var PosLine = this.ParaMath.GetLinePosition(_CurLine);
var PosLine = this.ParaMath.GetLinePosition(_CurLine, _CurRange);
if(bEmpty)
SearchPos.CurX = PosLine.x + this.pos.x;
......
......@@ -604,7 +604,7 @@ CAccent.prototype.Draw_Elements = function(PDSE)
var oBase = this.Content[0];
oBase.Draw_Elements(PDSE);
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line, PDSE.Range);
var x = PosLine.x,
y = PosLine.y;
......
......@@ -362,9 +362,10 @@ CMathBase.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
CMathBase.prototype.UpdatePosBound = function(pos, PRSA, Line, Range, Page)
{
var CurLine = Line - this.StartLine;
var CurRange = ( 0 === CurLine ? Range - this.StartRange : Range);
this.Bounds.SetPos(CurLine, pos, PRSA);
this.Bounds.SetPage(CurLine, Page);
this.Bounds.SetPos(CurLine, CurRange, pos, PRSA);
this.Bounds.SetPage(CurLine, CurRange, Page);
};
CMathBase.prototype.draw = function(x, y, pGraphics, PDSE)
{
......@@ -1106,19 +1107,21 @@ CMathBase.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRang
if ( 0 !== PRSA.LettersSkip )
{
WidthVisible = this.Bounds.GetWidth(CurLine);
WidthVisible = this.Bounds.GetWidth(CurLine, CurRange);
PRSA.LettersSkip--;
}
else
WidthVisible = this.Bounds.GetWidth(CurLine) + PRSA.JustifyWord;
WidthVisible = this.Bounds.GetWidth(CurLine, CurRange) + PRSA.JustifyWord;
PRSA.X += WidthVisible;
PRSA.LastW = WidthVisible;
};
CMathBase.prototype.Get_Width = function(_CurLine)
CMathBase.prototype.Get_Width = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
return this.Bounds.GetWidth(CurLine);
var CurLine = _CurLine - this.StartLine,
CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
return this.Bounds.GetWidth(CurLine, CurRange);
};
CMathBase.prototype.Save_RecalculateObject = function(Copy)
{
......@@ -1309,18 +1312,41 @@ CMathBase.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine
if (nCount <= 0)
return false;
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos, EndPos;
if(this.bOneLine == false)
{
StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
}
else
{
StartPos = 0;
EndPos = nCount - 1;
}
var aBounds = [];
for (var nIndex = 0; nIndex < nCount; nIndex++)
{
var oBounds = this.Content[nIndex].Get_LineBound(_CurLine);
if(oBounds == undefined)
if(nIndex < StartPos || nIndex > EndPos)
{
aBounds.push(null);
else if (oBounds.W > 0.001 && oBounds.H > 0.001)
aBounds.push(oBounds);
}
else
aBounds.push(null);
{
var oBounds = this.Content[nIndex].Get_LineBound(_CurLine, _CurRange);
if(oBounds == undefined)
aBounds.push(null);
else if (oBounds.W > 0.001 && oBounds.H > 0.001)
aBounds.push(oBounds);
else
aBounds.push(null);
}
}
var X = SearchPos.X;
......@@ -1430,7 +1456,7 @@ CMathBase.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selectio
if(SelectionUse == true && SelectionStartPos !== SelectionEndPos)
{
var Bound = this.Bounds.Get_LineBound(CurLine);
var Bound = this.Bounds.Get_LineBound(CurLine, CurRange);
SelectionDraw.FindStart = false;
SelectionDraw.W += Bound.W;
......@@ -1438,7 +1464,7 @@ CMathBase.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selectio
else if(SelectionUse == true && ContentSelect == true)
{
var Item = this.Content[SelectionStartPos];
var BoundItem = Item.Get_LineBound(_CurLine);
var BoundItem = Item.Get_LineBound(_CurLine, _CurRange);
SelectionDraw.StartX = BoundItem.X;
......@@ -1447,7 +1473,7 @@ CMathBase.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selectio
}
else if(SelectionDraw.FindStart == true)
{
SelectionDraw.StartX += this.Bounds.GetWidth(CurLine);
SelectionDraw.StartX += this.Bounds.GetWidth(CurLine, CurRange);
}
};
......@@ -1527,7 +1553,7 @@ CMathBase.prototype.Draw_HighLights = function(PDSH, bAll)
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
this.Content[CurPos].Draw_HighLights(PDSH, bAllCont);
var Bound = this.Get_LineBound(PDSH.Line);
var Bound = this.Get_LineBound(PDSH.Line, PDSH.Range);
if (true === bDrawShd)
PDSH.Shd.Add(Y0, Y1, X, X + Bound.W, 0, ShdColor.r, ShdColor.g, ShdColor.b );
......@@ -1586,7 +1612,7 @@ CMathBase.prototype.Draw_Lines = function(PDSL)
var CurLine = PDSL.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PDSL.Range - this.StartRange : PDSL.Range );
var Bound = this.Bounds.Get_LineBound(CurLine);
var Bound = this.Bounds.Get_LineBound(CurLine, CurRange);
if ( true === CtrPrp.DStrikeout )
aDStrikeout.Add( Y, Y, X, X + Bound.W, LineW, CurColor.r, CurColor.g, CurColor.b );
......@@ -1745,8 +1771,8 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.recalculateSize(g_oTextMeasurer);
this.Update_WordLen(PRS, WordLen);
this.Bounds.SetWidth(0, this.size.width);
this.Bounds.UpdateMetrics(0, this.size);
this.Bounds.SetWidth(0, 0, this.size.width);
this.Bounds.UpdateMetrics(0, 0, this.size);
}
else
{
......@@ -1871,7 +1897,8 @@ CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _C
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
}
this.Bounds.UpdateMetrics(CurLine, this.size);
//this.Bounds.UpdateMetrics(CurLine, CurRange, this.size);
this.Bounds.UpdateMetrics(0, 0, this.size);
// чтобы внутр объекты не перебили метрики (например, у внутр мат объекта Asc может быть больше Asc текущего объекта)
......@@ -1892,9 +1919,9 @@ CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _C
var Item = this.Content[CurPos];
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
var BoundItem = Item.Get_LineBound(_CurLine);
var BoundItem = Item.Get_LineBound(_CurLine, _CurRange);
this.Bounds.UpdateMetrics(CurLine, BoundItem);
this.Bounds.UpdateMetrics(CurLine, CurRange, BoundItem);
//ContentMetrics.UpdateMetrics(BoundItem);
this.UpdatePRS(PRS, BoundItem);
......@@ -1913,10 +1940,12 @@ CMathBase.prototype.IsEmptyLine = function(_CurLine, _CurRange)
return bEmpty;
};
CMathBase.prototype.Get_LineBound = function(_CurLine)
CMathBase.prototype.Get_LineBound = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
return this.Bounds.Get_LineBound(CurLine);
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
return this.Bounds.Get_LineBound(CurLine, CurRange);
};
CMathBase.prototype.UpdatePRS = function(PRS, Metric)
{
......@@ -1987,7 +2016,7 @@ CMathBase.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange
}
}
this.Bounds.SetWidth(CurLine, PRSC.Range.W - RangeW);
this.Bounds.SetWidth(CurLine, CurRange, PRSC.Range.W - RangeW);
};
CMathBase.prototype.UpdateOperators = function(_CurLine, _CurRange, bEmptyGapLeft, bEmptyGapRight)
{
......@@ -2093,55 +2122,55 @@ CMathBounds.prototype.Reset = function()
{
this.Bounds.length = 0;
};
CMathBounds.prototype.CheckLineBound = function(Line)
CMathBounds.prototype.CheckLineBound = function(Line, Range)
{
if(this.Bounds.length <= Line)
{
this.Bounds[Line] = new CMathBoundsMeasures();
this.Bounds[Line] = [];
}
if(this.Bounds[Line].length <= Range)
{
this.Bounds[Line][Range] = new CMathBoundsMeasures();
}
};
CMathBounds.prototype.UpdateMetrics = function(Line, Metric)
{
this.CheckLineBound(Line);
this.Bounds[Line].UpdateMetrics(Metric);
};
CMathBounds.prototype.UpdateWidth = function(Line, Width)
CMathBounds.prototype.UpdateMetrics = function(Line, Range, Metric)
{
this.CheckLineBound(Line);
this.Bounds[Line].UpdateWidth(Width);
this.CheckLineBound(Line, Range);
this.Bounds[Line][Range].UpdateMetrics(Metric);
};
CMathBounds.prototype.SetWidth = function(Line, Width)
CMathBounds.prototype.SetWidth = function(Line, Range, Width)
{
this.CheckLineBound(Line);
this.Bounds[Line].SetWidth(Width);
this.CheckLineBound(Line, Range);
this.Bounds[Line][Range].SetWidth(Width);
};
CMathBounds.prototype.SetPage = function(Line, Page)
CMathBounds.prototype.SetPage = function(Line, Range, Page)
{
this.CheckLineBound(Line);
this.Bounds[Line].SetPage(Page);
this.Bounds[Line][Range].SetPage(Page);
};
CMathBounds.prototype.GetWidth = function(Line)
CMathBounds.prototype.GetWidth = function(Line, Range)
{
return this.Bounds[Line].W;
return this.Bounds[Line][Range].W;
};
CMathBounds.prototype.GetAscent = function(Line)
/*CMathBounds.prototype.GetAscent = function(Line, Range)
{
return this.Bounds[Line].Asc;
return this.Bounds[Line][Range].Asc;
};
CMathBounds.prototype.GetHeight = function(Line)
CMathBounds.prototype.GetHeight = function(Line, Range)
{
return this.Bounds[Line].H;
};
return this.Bounds[Line][Range].H;
};*/
CMathBounds.prototype.Get_Bounds = function()
{
return this.Bounds;
};
CMathBounds.prototype.Get_LineBound = function(CurLine)
CMathBounds.prototype.Get_LineBound = function(CurLine, CurRange)
{
var Bound;
if(CurLine < this.Bounds.length)
if(CurLine < this.Bounds.length && CurRange < this.Bounds[CurLine].length)
{
Bound = this.Bounds[CurLine];
Bound = this.Bounds[CurLine][CurRange];
}
else // заглушка, если еще не пересчитали, а запрос Bonds пришел (например, на поиске)
{
......@@ -2150,22 +2179,22 @@ CMathBounds.prototype.Get_LineBound = function(CurLine)
return Bound;
};
CMathBounds.prototype.SetPos = function(Line, Pos, PRSA)
CMathBounds.prototype.SetPos = function(Line, Range, Pos, PRSA)
{
this.CheckLineBound(Line);
this.Bounds[Line].SetPos(Pos, PRSA);
this.CheckLineBound(Line, Range);
this.Bounds[Line][Range].SetPos(Pos, PRSA);
};
CMathBounds.prototype.ShiftPos = function(Line, Dx, Dy)
CMathBounds.prototype.ShiftPos = function(Line, Range, Dx, Dy)
{
this.CheckLineBound(Line);
this.Bounds[Line].ShiftPos(Line, Dx, Dy);
this.CheckLineBound(Line, Range);
this.Bounds[Line][Range].ShiftPos(Dx, Dy);
};
CMathBounds.prototype.GetPos = function(Line)
CMathBounds.prototype.GetPos = function(Line, Range)
{
var Pos = new CMathPosition();
Pos.x = this.Bounds[Line].GetX();
Pos.y = this.Bounds[Line].GetY();
Pos.x = this.Bounds[Line][Range].GetX();
Pos.y = this.Bounds[Line][Range].GetY();
return Pos;
};
......@@ -2201,10 +2230,6 @@ CMathBoundsMeasures.prototype.UpdateMetrics = function(Metric)
this.H = Descent + this.Asc;
}
};
CMathBoundsMeasures.prototype.UpdateWidth = function(Width)
{
this.W += Width;
};
CMathBoundsMeasures.prototype.SetWidth = function(Width)
{
this.W = Width;
......@@ -2218,7 +2243,7 @@ CMathBoundsMeasures.prototype.SetPos = function(Pos, PRSA)
this.X = PRSA.X + Pos.x;
this.Y = PRSA.Y + Pos.y - this.Asc;
};
CMathBoundsMeasures.prototype.ShiftPos = function(Line, Dx, Dy)
CMathBoundsMeasures.prototype.ShiftPos = function(Dx, Dy)
{
this.X += Dx;
this.Y += Dy;
......
......@@ -214,7 +214,7 @@ CBorderBox.prototype.Draw_Elements = function(PDSE)
var Width = this.size.width - this.GapLeft - this.GapRight,
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,
Y = this.pos.y + PosLine.y;
......
......@@ -102,7 +102,7 @@ CDegreeBase.prototype.recalculateSize = function(oMeasure)
{
var Metric = new CMathBoundsMeasures();
Metric.UpdateMetrics(this.baseContent.size);
Metric.UpdateWidth(this.baseContent.size.width);
Metric.SetWidth(this.baseContent.size.width);
this.setDistance();
......@@ -437,7 +437,7 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
this.iterContent.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;
if(this.Pr.type === DEGREE_SUPERSCRIPT)
......@@ -449,7 +449,7 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
Bound = this.GetSizeSubScript(g_oTextMeasurer, BoundBase);
}
this.Bounds.UpdateMetrics(CurLine, Bound);
this.Bounds.UpdateMetrics(CurLine, CurRange, Bound);
ContentMetrics.UpdateMetrics(Bound);
this.UpdatePRS(PRS, Bound);
......@@ -646,7 +646,7 @@ CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure)
{
var Metric = new CMathBoundsMeasures();
Metric.UpdateMetrics(this.baseContent.size);
Metric.UpdateWidth(this.baseContent.size.width);
Metric.SetWidth(this.baseContent.size.width);
var ResultSize = this.GetSize(oMeasure, Metric);
......@@ -845,14 +845,14 @@ CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine
// основание, baseContent
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);
this.Bounds.UpdateMetrics(CurLine, Bound);
this.Bounds.UpdateMetrics(CurLine, CurRange, Bound);
ContentMetrics.UpdateMetrics(Bound);
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);
}
......@@ -930,7 +930,6 @@ CDegreeSubSup.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
this.protected_FillRange(CurLine, CurRange, RangeStartPos, RangeEndPos);
}
};
CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
......@@ -961,7 +960,7 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR
this.iters.iterUp.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;
}
......@@ -974,7 +973,7 @@ CDegreeSubSup.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurR
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)
......
......@@ -92,7 +92,7 @@ CFraction.prototype.drawBarFraction = function(PDSE)
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,
x2 = this.pos.x + PosLine.x + this.GapLeft + width,
......@@ -125,7 +125,7 @@ CFraction.prototype.drawSkewedFraction = function(PDSE)
var tg1 = -2.22,
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,
Y = this.pos.y + PosLine.y;
......@@ -208,7 +208,7 @@ CFraction.prototype.drawLinearFraction = function(PDSE)
{
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,
Y = this.pos.y + PosLine.y;
......
......@@ -991,7 +991,7 @@ CMathContent.prototype.ApplyPoints = function(WidthsPoints, Points, MaxDimWidths
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)
{
......@@ -1013,10 +1013,9 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
this.pos.x = pos.x;
}
if(this.IsStartRange(Line, Range))
this.Bounds.SetPos(CurLine, this.pos, PRSA);
this.Bounds.SetPos(CurLine, CurRange, this.pos, PRSA);
this.Bounds.SetPage(CurLine, Page);
this.Bounds.SetPage(CurLine, CurRange, Page);
for(var i = StartPos; i <= EndPos; i++)
{
......@@ -1031,7 +1030,7 @@ CMathContent.prototype.Shift_Range = function(Dx, Dy, _CurLine, _CurRange)
var CurLine = _CurLine - this.StartLine;
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);
};
......@@ -3576,7 +3575,7 @@ CMathContent.prototype.Get_EndPos = function(BehindEnd, ContentPos, Depth)
};
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;
var CurLine = PDSH.Line - this.StartLine;
......@@ -3615,7 +3614,7 @@ CMathContent.prototype.Draw_Lines = function(PDSL)
var StartPos = this.protected_GetRangeStartPos(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;
......@@ -3726,7 +3725,7 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec
if(this.bRoot == false)
{
var Bound = this.Get_LineBound(_CurLine);
var Bound = this.Get_LineBound(_CurLine, _CurRange);
SelectionDraw.StartY = Bound.Y;
SelectionDraw.H = Bound.H;
}
......@@ -3740,7 +3739,7 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec
if(Item.Type == para_Math_Composition && bSelectAll)
{
SelectionDraw.FindStart = false;
SelectionDraw.W += Item.Get_Width(_CurLine);
SelectionDraw.W += Item.Get_Width(_CurLine, _CurRange);
}
else
{
......@@ -4137,7 +4136,7 @@ CMathContent.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRa
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)
{
......@@ -4160,7 +4159,7 @@ CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine,
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
}
this.Bounds.UpdateMetrics(CurLine, NewContentMetrics);
this.Bounds.UpdateMetrics(CurLine, CurRange, NewContentMetrics);
ContentMetrics.UpdateMetrics(NewContentMetrics);
};
......@@ -4184,25 +4183,31 @@ CMathContent.prototype.Get_Bounds = function()
{
return this.Bounds.Get_Bounds();
};
CMathContent.prototype.Get_LineBound = function(_CurLine)
CMathContent.prototype.Get_LineBound = function(_CurLine, _CurRange)
{
var CurLine = _CurLine - this.StartLine;
return this.Bounds.Get_LineBound(CurLine);
var CurLine = _CurLine - this.StartLine,
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;
this.Bounds.SetPage(CurLine, Page);
};
CMathContent.prototype.GetPos = function(Line)
};*/
CMathContent.prototype.GetPos = function(_CurLine, _CurRange)
{
var CurLine = Line - this.StartLine;
return this.Bounds.GetPos(CurLine);
var CurLine = _CurLine - this.StartLine,
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;
return this.Bounds.GetWidth(CurLine);
var CurLine = _CurLine - this.StartLine,
CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
return this.Bounds.GetWidth(CurLine, CurRange);
};
CMathContent.prototype.Get_StartRangePos = function(_CurLine, _CurRange, SearchPos, Depth)
{
......
......@@ -132,7 +132,7 @@ CMathBaseText.prototype.Can_AddNumbering = function()
};
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);
};
......
......@@ -550,7 +550,7 @@ CNary.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
this.LowerIterator.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;
......@@ -564,7 +564,7 @@ CNary.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
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)
......@@ -609,9 +609,9 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
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);
......@@ -622,7 +622,7 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
if(this.Base.IsJustDraw())
{
this.Bounds.UpdateMetrics(CurLine, this.Base.size);
this.Bounds.UpdateMetrics(CurLine, CurRange, this.Base.size);
ContentMetrics.UpdateMetrics(this.Base.size);
this.UpdatePRS(PRS, this.Base.size);
}
......@@ -637,7 +637,7 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
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);
}
......@@ -904,7 +904,7 @@ CNaryOperator.prototype.Draw_Elements = function(PDSE)
{
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)
this.drawTextElem(PosLine.x, PosLine.y, PDSE.Graphics);
......
......@@ -3749,7 +3749,7 @@ CDelimiter.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
};
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)
{
......@@ -3958,7 +3958,7 @@ CCharacter.prototype.Draw_Elements = function(PDSE)
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);
......
......@@ -644,7 +644,7 @@ CRadical.prototype.Draw_Elements = function(PDSE)
{
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);
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