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

Исправлен баг с расчетом Bounds контентов

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62192 954022d7-b5bf-4e40-9824-e11837661b57
parent f3a886fb
......@@ -919,8 +919,9 @@ ParaMath.prototype.Recalculate_Set_RangeEndPos = function(PRS, PRP, Depth)
};
ParaMath.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
{
PRS.ContentMetrics = new CMathBoundsMeasures();
this.Root.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
//PRS.ContentMetrics = new CMathBoundsMeasures();
var ContentMetrics = new CMathBoundsMeasures();
this.Root.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
};
ParaMath.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
{
......
......@@ -2173,7 +2173,7 @@ function CParagraphRecalculateStateWrap(Para)
this.bMathWordLarge = false; // for ParaMath
this.bEndRunToContent = false;
this.PosEndRun = new CParagraphContentPos();
this.ContentMetrics = new CMathBoundsMeasures();
//this.ContentMetrics = new CMathBoundsMeasures();
}
CParagraphRecalculateStateWrap.prototype =
......
......@@ -2622,7 +2622,7 @@ ParaRun.prototype.Recalculate_Set_RangeEndPos = function(PRS, PRP, Depth)
this.protected_FillRangeEndPos(CurLine, CurRange, CurPos);
};
ParaRun.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
ParaRun.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var Para = PRS.Paragraph;
......@@ -2660,7 +2660,7 @@ ParaRun.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
case para_Math_Placeholder:
case para_Math_BreakOperator:
{
PRS.ContentMetrics.UpdateMetrics(Item.size);
ContentMetrics.UpdateMetrics(Item.size);
UpdateLineMetricsText = true;
break;
......
......@@ -1881,7 +1881,7 @@ CMathBase.prototype.Recalculate_Range_OneLine = function(PRS, ParaPr, Depth)
{
this.Recalculate_Range(PRS, ParaPr, Depth);
};
CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = (0 === CurLine ? _CurRange - this.StartRange : _CurRange);
......@@ -1895,21 +1895,19 @@ CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _C
if(this.bOneLine)
{
var ParentContentMetric = PRS.ContentMetrics;
var NewContentMetrics = new CMathBoundsMeasures();
for (var CurPos = 0; CurPos <= this.Content.length - 1; CurPos++)
{
PRS.ContentMetrics = new CMathBoundsMeasures();
var Item = this.Content[CurPos];
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
}
this.Bounds.UpdateMetrics(CurLine, this.size);
ParentContentMetric.UpdateMetrics(this.size);
PRS.ContentMetrics.SetBound(ParentContentMetric);
// чтобы внутр объекты не перебили метрики (например, у внутр мат объекта Asc может быть больше Asc текущего объекта)
//PRS.ContentMetrics.UpdateMetrics(this.size);
ContentMetrics.UpdateMetrics(this.size);
if(this.Parent.bRoot)
{
......@@ -1924,12 +1922,12 @@ CMathBase.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _C
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++)
{
var Item = this.Content[CurPos];
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
var BoundItem = Item.Get_LineBound(_CurLine);
this.Bounds.UpdateMetrics(CurLine, BoundItem);
PRS.ContentMetrics.UpdateMetrics(BoundItem);
//ContentMetrics.UpdateMetrics(BoundItem);
this.UpdatePRS(PRS, BoundItem);
}
......@@ -1973,7 +1971,7 @@ CMathBase.prototype.UpdateMetrics = function(PRS, Size)
if(PRS.LineDescent < Size.height - Size.ascent)
PRS.LineDescent = Size.height - Size.ascent;
PRS.ContentMetrics.UpdateMetrics(Size);
//PRS.ContentMetrics.UpdateMetrics(Size);
};
CMathBase.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRange)
{
......@@ -2183,15 +2181,6 @@ function CMathBoundsMeasures()
this.Asc = 0;
this.Page = 0;
}
CMathBoundsMeasures.prototype.SetBound = function(Bound)
{
this.X = Bound.X;
this.Y = Bound.Y;
this.W = Bound.W;
this.H = Bound.H;
this.Asc = Bound.Asc;
this.Page = Bound.Page;
};
CMathBoundsMeasures.prototype.UpdateMetrics = function(Metric)
{
var MetricH = Metric.Type == MATH_SIZE ? Metric.height : Metric.H;
......
......@@ -412,7 +412,7 @@ CDegree.prototype.Document_UpdateInterfaceState = function(MathProps)
MathProps.Type = c_oAscMathInterfaceType.Script;
MathProps.Pr = null;
};
CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var CurLine = PRS.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range );
......@@ -424,8 +424,11 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
if(this.bOneLine == false && this.baseContent.Math_Is_End( _CurLine, _CurRange))
{
this.iterContent.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
this.baseContent.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
// чтобы при вычислении метрик итератора не были перебили метрики (например, у внутр мат объекта Asc может быть больше Asc текущего объекта)
var NewContentMetrics = new CMathBoundsMeasures();
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 Bound;
......@@ -440,13 +443,13 @@ CDegree.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _Cur
}
this.Bounds.UpdateMetrics(CurLine, Bound);
PRS.ContentMetrics.UpdateMetrics(Bound);
ContentMetrics.UpdateMetrics(Bound);
this.UpdatePRS(PRS, Bound);
}
else
{
CDegreeBase.prototype.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange);
CDegreeBase.prototype.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
}
};
......@@ -814,7 +817,7 @@ CDegreeSubSup.prototype.fillContent = function()
CDegreeSubSup.superclass.fillContent.call(this);
};
CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var CurLine = PRS.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range );
......@@ -826,15 +829,20 @@ CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine
if(this.bOneLine == false && this.Need_Iters(_CurLine, _CurRange))
{
this.Content[0].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
this.Content[1].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
this.Content[2].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
// чтобы при вычислении метрик итератора не были перебили метрики (например, у внутр мат объекта Asc может быть больше Asc текущего объекта)
var NewContentMetrics = new CMathBoundsMeasures();
this.Content[1].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
this.Content[2].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
// основание, baseContent
this.Content[0].Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
var BoundBase = this.baseContent.Get_LineBound(_CurLine);
var Bound = this.GetSize(g_oTextMeasurer, BoundBase);
this.Bounds.UpdateMetrics(CurLine, Bound);
PRS.ContentMetrics.UpdateMetrics(Bound);
ContentMetrics.UpdateMetrics(Bound);
this.iters.Bounds.Reset();
this.iters.Bounds.UpdateMetrics(0, this.iters.size);
......@@ -843,7 +851,7 @@ CDegreeSubSup.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine
}
else
{
CDegreeBase.prototype.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange);
CDegreeBase.prototype.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
}
};
......
......@@ -4132,7 +4132,7 @@ CMathContent.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRa
this.Bounds.SetWidth(CurLine, PRSC.Range.W - RangeW);
};
CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = (0 === CurLine ? _CurRange - this.StartRange : _CurRange);
......@@ -4145,21 +4145,17 @@ CMathContent.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine,
this.Bounds.Reset();
}
var ParentContentMetric = PRS.ContentMetrics;
PRS.ContentMetrics = new CMathBoundsMeasures();
var NewContentMetrics = new CMathBoundsMeasures();
for(var Pos = StartPos; Pos <= EndPos; Pos++)
{
var Item = this.Content[Pos];
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
Item.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
}
this.Bounds.UpdateMetrics(CurLine, PRS.ContentMetrics);
this.Bounds.UpdateMetrics(CurLine, NewContentMetrics);
ParentContentMetric.UpdateMetrics(PRS.ContentMetrics);
//PRS.ContentMetrics = ParentContentMetric;
PRS.ContentMetrics.SetBound(ParentContentMetric);
ContentMetrics.UpdateMetrics(NewContentMetrics);
};
CMathContent.prototype.Get_Bounds = function()
{
......
......@@ -574,11 +574,11 @@ CNary.prototype.Draw_Elements = function(PDSE)
this.Arg.Draw_Elements(PDSE);
};
CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
if(this.bOneLine)
{
CNary.superclass.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange);
CNary.superclass.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
}
else
{
......@@ -588,12 +588,11 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
// т.к. ParaNumbering привязывается к первому текстовому элементы, он может находится в аргументе
// обновляем LineMetrics для Base после того, как обновим метрики для аргумента
this.Arg.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
this.Arg.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
var BoundArg = this.Arg.Get_LineBound(_CurLine);
this.Bounds.UpdateMetrics(CurLine, BoundArg);
PRS.ContentMetrics.UpdateMetrics(BoundArg);
this.UpdatePRS(PRS, BoundArg);
......@@ -605,18 +604,21 @@ CNary.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRa
if(this.Base.IsJustDraw())
{
this.Bounds.UpdateMetrics(CurLine, this.Base.size);
PRS.ContentMetrics.UpdateMetrics(this.Base.size);
ContentMetrics.UpdateMetrics(this.Base.size);
this.UpdatePRS(PRS, this.Base.size);
}
else
{
this.Base.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
this.LowerIterator.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
this.UpperIterator.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange);
// чтобы при вычислении метрик итераторов не были перебили метрики (например, у внутр мат объекта Asc может быть больше Asc текущего объекта)
this.Bounds.UpdateMetrics(CurLine, this.Base.size);
PRS.ContentMetrics.UpdateMetrics(this.Base.size);
var NewContentMetrics = new CMathBoundsMeasures();
this.LowerIterator.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
this.UpperIterator.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, NewContentMetrics);
this.Base.Recalculate_LineMetrics(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
this.Bounds.UpdateMetrics(CurLine, this.Base.size);
this.UpdatePRS(PRS, this.Base.size);
}
......
......@@ -3504,12 +3504,12 @@ CDelimiter.prototype.Is_EmptyGaps = function()
return result;
};
CDelimiter.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange)
CDelimiter.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _CurRange, ContentMetrics)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = (0 === CurLine ? _CurRange - this.StartRange : _CurRange);
CDelimiter.superclass.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange);
CDelimiter.superclass.Recalculate_LineMetrics.call(this, PRS, ParaPr, _CurLine, _CurRange, ContentMetrics);
if(CurLine == 0 && CurRange == 0)
{
......@@ -3523,7 +3523,7 @@ CDelimiter.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _
if ( PRS.LineDescent < BegDescent )
PRS.LineDescent = BegDescent;
PRS.ContentMetrics.UpdateMetrics(this.begOper.size);
ContentMetrics.UpdateMetrics(this.begOper.size);
}
var bEnd = this.Content[0].Math_Is_End(_CurLine, _CurRange);
......@@ -3540,7 +3540,7 @@ CDelimiter.prototype.Recalculate_LineMetrics = function(PRS, ParaPr, _CurLine, _
if ( PRS.LineDescent < EndDescent )
PRS.LineDescent = EndDescent;
PRS.ContentMetrics.UpdateMetrics(this.endOper.size);
ContentMetrics.UpdateMetrics(this.endOper.size);
}
};
CDelimiter.prototype.RecalculateGeneralSize = function(oMeasure, height, ascent) // здесь пересчитываем скобки, общий максимальный размер delimiters
......
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