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

Разбивка на строки формул (инлайн и неинлайн). Выравнивание для формул не учитывается

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60869 954022d7-b5bf-4e40-9824-e11837661b57
parent e6029813
This diff is collapsed.
......@@ -52,6 +52,9 @@ var para_Math_Composition = 0x0033; // Математический о
var para_Math_Text = 0x0034; // Текст в формуле
var para_Math_Ampersand = 0x0035; // &
var para_Field = 0x0036; // Поле
var para_Math_BreakOperator = 0x0037; // break operator в формуле
var para_Math_Content = 0x0038; // math content
var break_Line = 0x01;
......
This diff is collapsed.
......@@ -467,31 +467,32 @@ CAccent.prototype.IsAccent = function()
{
return true;
};
CAccent.prototype.setPosition = function(pos, PosInfo)
CAccent.prototype.setPosition = function(pos, PDSE)
{
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var width = this.size.width - this.GapLeft - this.GapRight;
var oBase = this.Content[0];
var alignOp = (width - this.operator.size.width)/2,
alignCnt = (width- this.elements[0][0].size.width)/2;
alignCnt = (width - oBase.size.width)/2;
var PosOper = new CMathPosition();
PosOper.x = this.pos.x + this.GapLeft + alignOp;
PosOper.y = this.pos.y;
//PosOper.y = this.pos.y + this.size.ascent - this.shiftX;
this.operator.setPosition(PosOper);
var PosBase = new CMathPosition();
PosBase.x = this.pos.x + this.GapLeft + alignCnt;
PosBase.y = this.pos.y + this.operator.size.height;
PosBase.y = this.pos.y + this.operator.size.height + oBase.size.ascent;
oBase.setPosition(PosBase, PDSE);
this.elements[0][0].setPosition(PosBase, PosInfo);
pos.x += this.size.width;
};
CAccent.prototype.ApplyProperties = function(RPI)
{
......@@ -533,6 +534,30 @@ CAccent.prototype.Resize = function(oMeasure, RPI)
this.size = {height: height, width: width, ascent: ascent};
};
CAccent.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{
var CurLine = PRS.Line - this.StartLine;
var CurRange = ( 0 === CurLine ? PRS.Range - this.StartRange : PRS.Range );
var bMath_OneLine = PRS.bMath_OneLine;
var WordLen = PRS.WordLen; // запоминаем, чтобы внутр мат объекты не увеличили WordLen
PRS.bMath_OneLine = true;
var oBase = this.getBase();
oBase.Recalculate_Reset(PRS.Range, PRS.Line ); // обновим StartLine и StartRange
oBase.Recalculate_Range(PRS, ParaPr, Depth);
this.operator.fixSize(g_oTextMeasurer, oBase.size.width);
this.size.width = oBase.size.width + this.GapLeft + this.GapRight; // (!)
this.size.height = oBase.size.height + this.operator.size.height;
this.size.ascent = this.operator.size.height + oBase.size.ascent;
PRS.bMath_OneLine = bMath_OneLine;
this.Update_WordLen(PRS, WordLen);
};
CAccent.prototype.draw = function(x, y, pGraphics, PDSE)
{
var base = this.elements[0][0];
......@@ -567,6 +592,30 @@ CAccent.prototype.draw = function(x, y, pGraphics, PDSE)
this.operator.draw(x, y, pGraphics, PDSE);
};
CAccent.prototype.Draw_Elements = function(PDSE)
{
var oBase = this.Content[0];
oBase.Draw_Elements(PDSE);
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
var x = PosLine.x,
y = PosLine.y;
//var x = PDSE.X,
// y = PDSE.Y;
if(oBase.Is_InclineLetter())
{
if(this.Pr.chr != 0x305 && this.Pr.chr >= 0x300 && this.Pr.chr <= 0x315 || this.Pr.chr == 0x20DB)
{
var ascent = this.elements[0][0].size.ascent;
x += ascent*0.1;
}
}
this.operator.draw(x, y, PDSE.Graphics, PDSE);
};
CAccent.prototype.GetLastElement = function()
{
return this.Content[0].GetLastElement();
......
This diff is collapsed.
......@@ -201,17 +201,22 @@ CBorderBox.prototype.recalculateSize = function()
this.size = {width : width, height: height, ascent: ascent};
}
CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
CBorderBox.prototype.Draw_Elements = function(PDSE)
{
this.elements[0][0].draw(x, y, pGraphics, PDSE);
this.Content[0].Draw_Elements(PDSE);
var penW = this.Get_TxtPrControlLetter().FontSize*0.02;
var Width = this.size.width - this.GapLeft - this.GapRight,
Height = this.size.height;
var X = this.pos.x + x + this.GapLeft,
Y = this.pos.y + y;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
var X = this.pos.x + PosLine.x + this.GapLeft,
Y = this.pos.y + PosLine.y;
/*var X = this.pos.x + PDSE.X + this.GapLeft,
Y = this.pos.y + PDSE.Y;*/
this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp());
......@@ -222,7 +227,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
x2 = X + Width,
y1 = Y;
pGraphics.drawHorLine(0, y1, x1, x2, penW);
PDSE.Graphics.drawHorLine(0, y1, x1, x2, penW);
}
if(!this.Pr.hideBot)
......@@ -231,7 +236,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
x2 = X + Width,
y1 = Y + Height;
pGraphics.drawHorLine(2, y1, x1, x2, penW);
PDSE.Graphics.drawHorLine(2, y1, x1, x2, penW);
}
if(!this.Pr.hideLeft)
......@@ -240,7 +245,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
y1 = Y,
y2 = Y + Height;
pGraphics.drawVerLine(0, x1, y1, y2, penW);
PDSE.Graphics.drawVerLine(0, x1, y1, y2, penW);
}
if(!this.Pr.hideRight)
......@@ -249,7 +254,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
y1 = Y,
y2 = Y + Height;
pGraphics.drawVerLine(2, x1, y1, y2, penW);
PDSE.Graphics.drawVerLine(2, x1, y1, y2, penW);
}
if(this.Pr.strikeTLBR) // left diagonal
......@@ -259,12 +264,12 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
var x1 = X, y1 = Y,
x2 = X + Width, y2 = Y + Height;
pGraphics.p_width(180);
PDSE.Graphics.p_width(180);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics.ds();
PDSE.Graphics._s();
PDSE.Graphics._m(x1, y1);
PDSE.Graphics._l(x2, y2);
PDSE.Graphics.ds();
}
else
{
......@@ -278,17 +283,17 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
x6 = X, y6 = Y + pW,
x7 = X, y7 = Y;
pGraphics.p_width(1000);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics._l(x3, y3);
pGraphics._l(x4, y4);
pGraphics._l(x5, y5);
pGraphics._l(x6, y6);
pGraphics._l(x7, y7);
pGraphics.df();
PDSE.Graphics.p_width(1000);
PDSE.Graphics._s();
PDSE.Graphics._m(x1, y1);
PDSE.Graphics._l(x2, y2);
PDSE.Graphics._l(x3, y3);
PDSE.Graphics._l(x4, y4);
PDSE.Graphics._l(x5, y5);
PDSE.Graphics._l(x6, y6);
PDSE.Graphics._l(x7, y7);
PDSE.Graphics.df();
}
}
......@@ -300,12 +305,12 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
var x1 = X + Width, y1 = Y,
x2 = X, y2 = Y + Height;
pGraphics.p_width(180);
PDSE.Graphics.p_width(180);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics.ds();
PDSE.Graphics._s();
PDSE.Graphics._m(x1, y1);
PDSE.Graphics._l(x2, y2);
PDSE.Graphics.ds();
}
else
{
......@@ -320,17 +325,17 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
x7 = X + Width, y7 = Y;
pGraphics.p_width(1000);
PDSE.Graphics.p_width(1000);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics._l(x3, y3);
pGraphics._l(x4, y4);
pGraphics._l(x5, y5);
pGraphics._l(x6, y6);
pGraphics._l(x7, y7);
pGraphics.df();
PDSE.Graphics._s();
PDSE.Graphics._m(x1, y1);
PDSE.Graphics._l(x2, y2);
PDSE.Graphics._l(x3, y3);
PDSE.Graphics._l(x4, y4);
PDSE.Graphics._l(x5, y5);
PDSE.Graphics._l(x6, y6);
PDSE.Graphics._l(x7, y7);
PDSE.Graphics.df();
}
}
......@@ -341,7 +346,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
x2 = X + Width,
y1 = Y + Height/2 - penW/2;
pGraphics.drawHorLine(0, y1, x1, x2, penW);
PDSE.Graphics.drawHorLine(0, y1, x1, x2, penW);
}
if(this.Pr.strikeV)
......@@ -350,17 +355,19 @@ CBorderBox.prototype.draw = function(x, y, pGraphics, PDSE)
y1 = Y,
y2 = Y + Height;
pGraphics.drawVerLine(0, x1, y1, y2, penW);
PDSE.Graphics.drawVerLine(0, x1, y1, y2, penW);
}
}
CBorderBox.prototype.setPosition = function(pos, PosInfo)
CBorderBox.prototype.setPosition = function(pos, PDSE)
{
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var NewPos = new CMathPosition();
var Base = this.Content[0];
if(this.Pr.hideLeft == false)
NewPos.x = this.pos.x + this.GapLeft + this.gapBrd;
else
......@@ -368,11 +375,13 @@ CBorderBox.prototype.setPosition = function(pos, PosInfo)
if(this.Pr.hideTop == false)
NewPos.y = this.pos.y + this.gapBrd;
NewPos.y = this.pos.y + this.gapBrd + Base.size.ascent;
else
NewPos.y = this.pos.y;
NewPos.y = this.pos.y + Base.size.ascent;
Base.setPosition(NewPos, PDSE); // base
this.elements[0][0].setPosition(NewPos, PosInfo);
pos.x += this.size.width;
}
function CMathBoxPr()
......
......@@ -105,6 +105,13 @@ CDegreeBase.prototype.Resize = function(oMeasure, RPI)
else if(this.Pr.type === DEGREE_SUBSCRIPT)
this.recalculateSubScript(oMeasure);
};
CDegreeBase.prototype.recalculateSize = function(oMeasure)
{
if(this.Pr.type === DEGREE_SUPERSCRIPT)
this.recalculateSup(oMeasure);
else if(this.Pr.type === DEGREE_SUBSCRIPT)
this.recalculateSubScript(oMeasure);
};
CDegreeBase.prototype.recalculateSup = function(oMeasure)
{
var base = this.elements[0][0].size,
......@@ -264,7 +271,37 @@ CDegreeBase.prototype.recalculateSubScript = function(oMeasure)
this.size = {width: width, height: height, ascent: ascent};
};
CDegreeBase.prototype.setPosition = function(pos, PosInfo)
CDegreeBase.prototype.setPosition = function(pos, PDSE)
{
this.pos.x = pos.x;
if(this.bInside === true)
this.pos.y = pos.y;
else
this.pos.y = pos.y - this.size.ascent;
var oBase = this.elements[0][0],
oIter = this.elements[0][1];
var PosBase = new CMathPosition();
PosBase.x = this.pos.x + this.GapLeft;
PosBase.y = this.pos.y + this.upBase;
if(oBase.Type == para_Math_Content)
PosBase.y += oBase.size.ascent;
var PosIter = new CMathPosition();
PosIter.x = this.pos.x + this.GapLeft + oBase.size.width + this.dW;
PosIter.y = this.pos.y + this.upIter + oIter.size.ascent;
oBase.setPosition(PosBase, PDSE);
oIter.setPosition(PosIter, PDSE);
pos.x += this.size.width;
};
CDegreeBase.prototype.old_setPosition = function(pos, PosInfo)
{
this.pos.x = pos.x;
......@@ -285,6 +322,7 @@ CDegreeBase.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(PosBase, PosInfo);
this.elements[0][1].setPosition(PosIter, PosInfo);
};
CDegreeBase.prototype.getIterator = function()
{
......
......@@ -69,7 +69,16 @@ CFraction.prototype.draw = function(x, y, pGraphics, PDSE)
else if(this.Pr.type == LINEAR_FRACTION)
this.drawLinearFraction(x, y, pGraphics, PDSE);
}
CFraction.prototype.drawBarFraction = function(x, y, pGraphics, PDSE)
CFraction.prototype.Draw_Elements = function(PDSE)
{
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
this.drawBarFraction(PDSE);
else if(this.Pr.type == SKEWED_FRACTION)
this.drawSkewedFraction(PDSE);
else if(this.Pr.type == LINEAR_FRACTION)
this.drawLinearFraction(PDSE);
}
CFraction.prototype.drawBarFraction = function(PDSE)
{
var mgCtrPrp = this.Get_TxtPrControlLetter();
......@@ -79,21 +88,23 @@ CFraction.prototype.drawBarFraction = function(x, y, pGraphics, PDSE)
var width = this.size.width - this.GapLeft - this.GapRight;
var x1 = this.pos.x + x + this.GapLeft,
x2 = x1 + width,
y1 = this.pos.y + y + numHeight- penW;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
var x1 = this.pos.x + PosLine.x + this.GapLeft,
x2 = this.pos.x + PosLine.x + this.GapLeft + width,
y1 = this.pos.y + PosLine.y + numHeight- penW;
if( !this.bHideBar )
{
pGraphics.SetFont(mgCtrPrp);
PDSE.Graphics.SetFont(mgCtrPrp);
this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp());
pGraphics.drawHorLine(0, y1, x1, x2, penW);
PDSE.Graphics.drawHorLine(0, y1, x1, x2, penW);
}
CFraction.superclass.draw.call(this, x, y, pGraphics, PDSE);
CFraction.superclass.Draw_Elements.call(this, PDSE);
}
CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics, PDSE)
CFraction.prototype.drawSkewedFraction = function(PDSE)
{
var mgCtrPrp = this.Get_TxtPrControlLetter();
......@@ -110,8 +121,10 @@ CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics, PDSE)
var tg1 = -2.22,
tg2 = -3.7;
var X = this.pos.x + x + this.GapLeft,
Y = this.pos.y + y;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
var X = this.pos.x + PosLine.x + this.GapLeft,
Y = this.pos.y + PosLine.y;
var heightSlash = this.size.height*2/3;
......@@ -175,24 +188,26 @@ CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics, PDSE)
}
pGraphics.SetFont(mgCtrPrp);
PDSE.Graphics.SetFont(mgCtrPrp);
pGraphics.p_width(penW*1000);
PDSE.Graphics.p_width(penW*1000);
this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp());
pGraphics._s();
pGraphics._m(xx1, yy1);
pGraphics._l(xx2, yy2);
pGraphics.ds();
PDSE.Graphics._s();
PDSE.Graphics._m(xx1, yy1);
PDSE.Graphics._l(xx2, yy2);
PDSE.Graphics.ds();
CFraction.superclass.draw.call(this, x, y, pGraphics, PDSE);
CFraction.superclass.Draw_Elements.call(this, PDSE);
}
CFraction.prototype.drawLinearFraction = function(x, y, pGraphics, PDSE)
CFraction.prototype.drawLinearFraction = function(PDSE)
{
var shift = 0.1*this.dW;
var X = this.pos.x + x + this.GapLeft,
Y = this.pos.y + y;
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
var X = this.pos.x + PosLine.x + this.GapLeft,
Y = this.pos.y + PosLine.y;
var x1 = X + this.elements[0][0].size.width + this.dW - shift,
y1 = Y,
......@@ -202,17 +217,17 @@ CFraction.prototype.drawLinearFraction = function(x, y, pGraphics, PDSE)
var mgCtrPrp = this.Get_TxtPrControlLetter();
var penW = mgCtrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
pGraphics.SetFont(mgCtrPrp);
pGraphics.p_width(penW*1000);
PDSE.Graphics.SetFont(mgCtrPrp);
PDSE.Graphics.p_width(penW*1000);
this.Make_ShdColor(PDSE, this.Get_CompiledCtrPrp());
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics.ds();
PDSE.Graphics._s();
PDSE.Graphics._m(x1, y1);
PDSE.Graphics._l(x2, y2);
PDSE.Graphics.ds();
CFraction.superclass.draw.call(this, x, y, pGraphics, PDSE);
CFraction.superclass.Draw_Elements.call(this, PDSE);
}
CFraction.prototype.getNumerator = function()
{
......@@ -359,10 +374,13 @@ CFraction.prototype.recalculateLinear = function()
this.size = {height: height, width: width, ascent: ascent};
}
CFraction.prototype.setPosition = function(pos, PosInfo)
CFraction.prototype.setPosition = function(pos, PDSE)
{
if(this.Pr.type == SKEWED_FRACTION)
{
var Numerator = this.Content[0],
Denominator = this.Content[1];
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
......@@ -372,19 +390,20 @@ CFraction.prototype.setPosition = function(pos, PosInfo)
var PosNum = new CMathPosition();
PosNum.x = X;
PosNum.y = Y;
PosNum.y = Y + Numerator.size.ascent;
var PosDen = new CMathPosition();
PosDen.x = X + this.elements[0][0].size.width + this.dW;
PosDen.y = Y + this.elements[0][0].size.height;
PosDen.x = X + Numerator.size.width + this.dW;
PosDen.y = Y + Numerator.size.height + Denominator.size.ascent;
this.elements[0][0].setPosition(PosNum, PosInfo);
this.elements[0][1].setPosition(PosDen, PosInfo);
Numerator.setPosition(PosNum, PDSE);
Denominator.setPosition(PosDen, PDSE);
pos.x += this.size.width;
}
else
CFraction.superclass.setPosition.call(this, pos, PosInfo);
CFraction.superclass.setPosition.call(this, pos, PDSE);
}
CFraction.prototype.fillContent = function()
{
......@@ -496,10 +515,6 @@ CNumerator.prototype.recalculateSize = function()
this.size = {width : width, height: height, ascent: ascent};
}
CNumerator.prototype.setPosition = function(pos, PosInfo)
{
this.elements[0][0].setPosition(pos, PosInfo);
}
function CDenominator(MathContent)
{
......@@ -519,7 +534,7 @@ CDenominator.prototype.recalculateSize = function()
var gapDen, minGap;
if(this.Parent.kind == MATH_LIMIT || this.Parent.kind == MATH_GROUP_CHARACTER)
if(this.Parent.kind == MATH_PRIMARY_LIMIT || this.Parent.kind == MATH_GROUP_CHARACTER)
{
gapDen = Height/2.6;
minGap = Height/10;
......@@ -540,13 +555,10 @@ CDenominator.prototype.recalculateSize = function()
this.size = {width : width, height: height, ascent: ascent};
}
CDenominator.prototype.setPosition = function(pos, PosInfo)
CDenominator.prototype.setPosition = function(pos, PDSE)
{
var NewPos = new CMathPosition();
NewPos.x = pos.x;
NewPos.y = pos.y + this.gap;
pos.y += this.gap;
this.elements[0][0].setPosition(NewPos, PosInfo);
CDenominator.superclass.setPosition.call(this, pos, PDSE);
}
//////////
......@@ -41,6 +41,7 @@ function CLimitPrimary(bInside, Type, FName, Iterator)
this.init(FName, Iterator);
}
Asc.extendClass(CLimitPrimary, CMathBase);
CLimitPrimary.prototype.kind = MATH_PRIMARY_LIMIT;
CLimitPrimary.prototype.init = function(FName, Iterator)
{
this.setDimension(2, 1);
......@@ -84,16 +85,20 @@ CLimitPrimary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, Gap
this.Iterator.PreRecalc(this, ParaMath, ArgSzIter, NewRPI);
};
CLimitPrimary.prototype.Resize = function(oMeasure, RPI)
{
this.FName.Resize(oMeasure, RPI);
this.Iterator.Resize(oMeasure, RPI);
this.recalculateSize(oMeasure);
};
CLimitPrimary.prototype.recalculateSize = function(oMeasure)
{
if(this.Type == LIMIT_LOW)
this.dH = 0;
else
this.dH = 0.06*this.Get_TxtPrControlLetter().FontSize;
this.FName.Resize(oMeasure, RPI);
this.Iterator.Resize(oMeasure, RPI);
var SizeFName = this.FName.size,
SizeIter = this.Iterator.size;
......
This diff is collapsed.
This diff is collapsed.
......@@ -18,6 +18,7 @@ var MATH_BAR = 14;
var MATH_PHANTOM = 15;
var MATH_RUN = 16;
var MATH_PRIMARY_LIMIT = 17;
var BAR_FRACTION = 0;
var SKEWED_FRACTION = 1;
......
......@@ -462,7 +462,7 @@ CMathMatrix.prototype.init = function(props)
this.fillContent();
}
CMathMatrix.prototype.setPosition = function(pos, PosInfo)
CMathMatrix.prototype.setPosition = function(pos, PDSE)
{
this.pos.x = pos.x;
......@@ -479,22 +479,23 @@ CMathMatrix.prototype.setPosition = function(pos, PosInfo)
var h = 0, w = 0;
for(var i=0; i < this.nRow; i++)
{
w = 0;
for(var j = 0; j < this.nCol; j++)
{
var Item = this.elements[i][j];
var al = this.align(i, j);
NewPos.x = this.pos.x + this.GapLeft + al.x + w;
NewPos.y = this.pos.y + al.y + h;
NewPos.y = this.pos.y + al.y + h + Item.size.ascent;
this.elements[i][j].setPosition(NewPos, PosInfo);
Item.setPosition(NewPos, PDSE);
w += Widths[j] + this.gaps.column[j];
}
h += Heights[i] + this.gaps.row[i];
}
pos.x += this.size.width;
}
CMathMatrix.prototype.getMetrics = function(RPI)
{
......@@ -722,14 +723,23 @@ CEqArray.prototype.fillContent = function()
for (var nIndex = 0; nIndex < nRowsCount; nIndex++)
this.elements[nIndex][0] = this.Content[nIndex];
};
/*CEqArray.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{
PRS.bMath_OneLine = true;
for (var Pos = 0, Count = this.Content.length; Pos < Count; Pos++)
this.Content[Pos].Recalculate_Range(PRS, ParaPr, Depth);
this.recalculateSize(g_oTextMeasurer);
};*/
CEqArray.prototype.Resize = function(oMeasure, RPI)
{
// на случай, чтобы не затереть массив
//var CurrAmperWPoints = RPI.AmperWPoints,
// CurrEqqArray = RPI.bEqqArray;
// CurrEqArray = RPI.bEqArray;
var NewRPI = RPI.Copy();
NewRPI.bEqqArray = true;
NewRPI.bEqArray = true;
for(var i = 0; i < this.nRow; i++)
this.elements[i][0].Resize(oMeasure, NewRPI);
......@@ -772,7 +782,7 @@ CEqArray.prototype.getMetrics = function()
for(var i = 0; i < this.nRow; i++)
{
var WidthsRow = this.elements[i][0].getWidthsPoints(),
var WidthsRow = this.elements[i][0].Get_WidthPoints().Widths,
len = WidthsRow.length;
if(Pos < len)
......@@ -784,7 +794,7 @@ CEqArray.prototype.getMetrics = function()
maxDim = WidthsRow[Pos].even < WidthsRow[Pos].odd ? WidthsRow[Pos].odd : WidthsRow[Pos].even;
maxDimWidth = WidthsRow[Pos].even + WidthsRow[Pos].odd;
}
even = even > WidthsRow[Pos].even ? even : WidthsRow[Pos].even; // before "odd"
even = even > WidthsRow[Pos].even ? even : WidthsRow[Pos].even; // before "odd"
odd = odd > WidthsRow[Pos].odd ? odd : WidthsRow[Pos].odd; // after "odd"
}
else
......@@ -848,11 +858,8 @@ CEqArray.prototype.getMetrics = function()
return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics};
}
CEqArray.prototype.setPosition = function(pos)
CEqArray.prototype.setPosition = function(pos, PDSE)
{
//PosInfo.Widths = this.WidthsPoints;
//PosInfo.Points = this.Points;
this.pos.x = pos.x;
if(this.bInside === true)
......@@ -869,19 +876,16 @@ CEqArray.prototype.setPosition = function(pos)
for(var i=0; i < this.nRow; i++)
{
var Item = this.elements[i][0];
NewPos.x = this.pos.x + this.GapLeft;
NewPos.y = this.pos.y + h;
//PosInfo.CurrPoint = 0;
this.elements[i][0].setPosition(NewPos);
NewPos.y = this.pos.y + h + Item.size.ascent;
Item.setPosition(NewPos, PDSE);
h += Heights[i] + this.gaps.row[i];
}
//PosInfo.Widths.length = 0;
//PosInfo.Points.length = 0;
pos.x += this.size.width;
}
CEqArray.prototype.getElement = function(num)
{
......@@ -896,4 +900,8 @@ CEqArray.prototype.Document_UpdateInterfaceState = function(MathProps)
MathProps.Type = c_oAscMathInterfaceType.EqArray;
MathProps.Pr = null;
};
CEqArray.prototype.IsEqArray = function()
{
return true;
};
......@@ -625,31 +625,35 @@ CNaryUndOvr.prototype.recalculateSize = function()
this.size = {width: width, height: height, ascent: ascent};
}
CNaryUndOvr.prototype.setPosition = function(pos, PosInfo)
CNaryUndOvr.prototype.setPosition = function(pos, PDSE)
{
this.pos.x = pos.x;
this.pos.y = pos.y;
var UpIter = this.elements[0][0],
Sign = this.elements[1][0],
LowIter = this.elements[2][0];
var PosUpIter = new CMathPosition();
PosUpIter.x = pos.x + this.GapLeft + this.align(0,0).x;
PosUpIter.y = pos.y;
PosUpIter.y = pos.y + UpIter.size.ascent;
var PosSign = new CMathPosition();
PosSign.x = pos.x + this.GapLeft + this.align(1,0).x;
PosSign.y = pos.y + this.elements[0][0].size.height + this.gapTop;
PosSign.y = pos.y + UpIter.size.height + this.gapTop;
var PosLowIter = new CMathPosition();
PosLowIter.x = pos.x + this.GapLeft + this.align(2,0).x;
PosLowIter.y = PosSign.y + this.elements[1][0].size.height + this.gapBottom;
PosLowIter.y = PosSign.y + Sign.size.height + this.gapBottom + LowIter.size.ascent;
this.elements[0][0].setPosition(PosUpIter, PosInfo);
this.elements[1][0].setPosition(PosSign, PosInfo);
this.elements[2][0].setPosition(PosLowIter, PosInfo);
UpIter.setPosition(PosUpIter, PDSE);
Sign.setPosition(PosSign, PDSE);
LowIter.setPosition(PosLowIter, PDSE);
}
CNaryUndOvr.prototype.setBase = function(base)
{
......@@ -680,16 +684,18 @@ function CNaryOperator(flip)
this.bFlip = (flip == -1);
this.sizeGlyph = null;
}
CNaryOperator.prototype.draw = function(x, y, pGraphics, PDSE)
CNaryOperator.prototype.Draw_Elements = function(PDSE)
{
this.Parent.Make_ShdColor(PDSE, this.Parent.Get_CompiledCtrPrp());
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
if(this.Type == para_Math_Text)
this.drawTextElem(x, y, pGraphics);
this.drawTextElem(PosLine.x, PosLine.y, PDSE.Graphics);
else
this.drawGlyph(x, y, pGraphics);
this.drawGlyph(PosLine.x, PosLine.y, PDSE.Graphics);
}
CNaryOperator.prototype.drawGlyph = function(x, y,pGraphics)
CNaryOperator.prototype.drawGlyph = function(x, y, pGraphics)
{
var coord = this.getCoord();
......@@ -778,7 +784,7 @@ CNaryOperator.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI)
this.Parent = Parent;
this.ParaMath = ParaMath;
}
CNaryOperator.prototype.Resize = function(oMeasure, RPI)
CNaryOperator.prototype.Measure = function(oMeasure, RPI)
{
this.recalculateSize(); //обычный пересчет, oMeasure не нужен
}
......
This diff is collapsed.
......@@ -497,17 +497,8 @@ CRadical.prototype.ApplyProperties = function(RPI)
this.RecalcInfo.bProps = false;
}
}
CRadical.prototype.Resize = function(oMeasure, RPI)
CRadical.prototype.recalculateSize = function(oMeasure)
{
if(this.Pr.type == SQUARE_RADICAL)
this.RealBase.Resize(oMeasure, RPI);
else
{
this.Iterator.Resize(oMeasure, RPI);
this.RealBase.Resize(oMeasure, RPI);
}
var shTop,
height, width, ascent;
......@@ -516,7 +507,7 @@ CRadical.prototype.Resize = function(oMeasure, RPI)
var txtPrp = this.Get_CompiledCtrPrp();
var sign = this.signRadical.size,
gSign = this.signRadical.gapSign,
// в случае смещения baseline контента тоже смещается, и по высоте артгумент может выйти чуть за пределы (т.о. значок интеграла будет расположен чуть выше, чем следовало бы, и размер аргумента выйде за границы)
// в случае смещения baseline контента тоже смещается, и по высоте артгумент может выйти чуть за пределы (т.о. значок интеграла будет расположен чуть выше, чем следовало бы, и размер аргумента выйде за границы)
gArg = this.signRadical.gapArg > 2*g_dKoef_pt_to_mm ? this.signRadical.gapArg : 2*g_dKoef_pt_to_mm; // делаем смещение, т.к. для fontSize 11, 14 и меньше высота плейсхолдера не совпадает
// с высотой отрисовки плейсхолдера и происходит наложение черты значка радикала и плейсхолдера
......@@ -530,10 +521,9 @@ CRadical.prototype.Resize = function(oMeasure, RPI)
ascent = gapBase + shTop + this.RealBase.size.ascent;
height = sign.height > ascent - this.RealBase.size.ascent + this.RealBase.size.height ? sign.height : ascent - this.RealBase.size.ascent + this.RealBase.size.height ;
height = sign.height > ascent - this.RealBase.size.ascent + this.RealBase.size.height ? sign.height : ascent - this.RealBase.size.ascent + this.RealBase.size.height;
width = sign.width;
//ascent = height - (base.height - base.ascent);
width += this.GapLeft + this.GapRight;
......@@ -585,7 +575,19 @@ CRadical.prototype.Resize = function(oMeasure, RPI)
this.size = {width: width, height: height, ascent: ascent};
}
}
CRadical.prototype.setPosition = function(pos, PosInfo)
CRadical.prototype.Resize = function(oMeasure, RPI)
{
if(this.Pr.type == SQUARE_RADICAL)
this.RealBase.Resize(oMeasure, RPI);
else
{
this.Iterator.Resize(oMeasure, RPI);
this.RealBase.Resize(oMeasure, RPI);
}
this.recalculateSize(oMeasure);
}
CRadical.prototype.setPosition = function(pos, PDSE)
{
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
......@@ -602,10 +604,10 @@ CRadical.prototype.setPosition = function(pos, PosInfo)
PosRadical.y = this.pos.y;
PosBase.x = this.pos.x + gapLeft;
PosBase.y = this.pos.y + gapTop;
PosBase.y = this.pos.y + gapTop + this.RealBase.size.ascent;
this.signRadical.setPosition(PosRadical);
this.RealBase.setPosition(PosBase, PosInfo);
this.RealBase.setPosition(PosBase, PDSE);
}
else if(this.Pr.type == DEGREE_RADICAL)
{
......@@ -614,9 +616,9 @@ CRadical.prototype.setPosition = function(pos, PosInfo)
var PosDegree = new CMathPosition();
PosDegree.x = this.pos.x + this.GapLeft + this.gapWidth;
PosDegree.y = this.pos.y + this.gapDegree;
PosDegree.y = this.pos.y + this.gapDegree + this.Iterator.size.ascent;
this.Iterator.setPosition(PosDegree, PosInfo);
this.Iterator.setPosition(PosDegree, PDSE);
var wDegree = this.Iterator.size.width > wTick ? this.Iterator.size.width - wTick : 0;
......@@ -626,15 +628,19 @@ CRadical.prototype.setPosition = function(pos, PosInfo)
this.signRadical.setPosition(PosRadical);
PosBase.x = this.pos.x + this.size.width - this.RealBase.size.width - this.GapRight;
PosBase.y = this.pos.y + this.size.ascent - this.RealBase.size.ascent;
PosBase.y = this.pos.y + this.size.ascent;
this.RealBase.setPosition(PosBase, PosInfo);
this.RealBase.setPosition(PosBase, PDSE);
}
pos.x += this.size.width;
}
CRadical.prototype.draw = function(x, y, pGraphics, PDSE)
CRadical.prototype.Draw_Elements = function(PDSE)
{
this.signRadical.draw(x, y, pGraphics, PDSE);
CRadical.superclass.draw.call(this, x, y, pGraphics, PDSE);
var PosLine = this.ParaMath.GetLinePosition(PDSE.Line);
this.signRadical.draw(PosLine.x, PosLine.y, PDSE.Graphics, PDSE);
CRadical.superclass.Draw_Elements.call(this, PDSE);
}
CRadical.prototype.getBase = function()
{
......
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