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

1. Реализовала выравнивание в EqqArray для Last элемента

2. new Array() -> []
3. extend -> Asc.extendClass (Common/editorscommon.js)
4. Поправила баг: не открывались файлы с Limit функциями в Inline формулах
5. Поправила баг для Limit функций в случае, если они находятся в Inline формулах. Если Limit обернут в MathFunc, то он должен отображаться в виде степени (то есть еще будет и аргумент для Limit в MathFunc), если же нет, то отображается стандартно

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58035 954022d7-b5bf-4e40-9824-e11837661b57
parent 0c1d00c5
......@@ -7726,27 +7726,30 @@ ParaRun.prototype.old_Math_SetPosition = function(pos, PosInfo, CurrWPoints)
}
ParaRun.prototype.Math_SetPosition = function(PosInfo)
{
var NewPos;
if(this.bEqqArray)
{
for(var Pos = 0; Pos < this.Content.length; Pos++)
{
var CurrElem = this.Content[Pos];
var NewPos = new CMathPosition();
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y - this.size.ascent;
NewPos = new CMathPosition();
if(this.Content[Pos].Type == para_Math_Ampersand)
{
PosInfo.UpdatePoint();
PosInfo.ApplyAlign();
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y - this.size.ascent;
CurrElem.setPosition(NewPos);
}
else
{
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y - this.size.ascent;
CurrElem.setPosition(NewPos);
}
......@@ -7899,7 +7902,7 @@ ParaRun.prototype.Math_SetPosition = function(PosInfo)
{
for(var i = 0; i < this.Content.length; i++)
{
var NewPos = new CMathPosition();
NewPos = new CMathPosition();
NewPos.x = PosInfo.x;
NewPos.y = PosInfo.y - this.size.ascent;
......
......@@ -19,7 +19,7 @@ function CAccentCircumflex()
{
CGlyphOperator.call(this);
}
extend(CAccentCircumflex, CGlyphOperator);
Asc.extendClass(CAccentCircumflex, CGlyphOperator);
CAccentCircumflex.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
......@@ -122,7 +122,7 @@ function CAccentLine()
{
CGlyphOperator.call(this);
}
extend(CAccentLine, CGlyphOperator);
Asc.extendClass(CAccentLine, CGlyphOperator);
CAccentLine.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
......@@ -166,7 +166,7 @@ function CAccentDoubleLine()
{
CGlyphOperator.call(this);
}
extend(CAccentDoubleLine, CGlyphOperator);
Asc.extendClass(CAccentDoubleLine, CGlyphOperator);
CAccentDoubleLine.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
......@@ -225,7 +225,7 @@ function CAccentTilde()
{
CGlyphOperator.call(this);
}
extend(CAccentTilde, CGlyphOperator);
Asc.extendClass(CAccentTilde, CGlyphOperator);
CAccentTilde.prototype.calcSize = function(stretch)
{
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
......@@ -312,7 +312,7 @@ function CAccentBreve()
{
CGlyphOperator.call(this);
}
extend(CAccentBreve, CGlyphOperator);
Asc.extendClass(CAccentBreve, CGlyphOperator);
CAccentBreve.prototype.calcSize = function(stretch)
{
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
......@@ -528,7 +528,7 @@ function CAccent(props)
g_oTableId.Add( this, this.Id );
}
extend(CAccent, CMathBase);
Asc.extendClass(CAccent, CMathBase);
CAccent.prototype.init = function(props)
{
this.setProperties(props);
......
......@@ -44,7 +44,7 @@ function CMathBase(bInside)
this.bInside = bInside === true ? true: false;
this.elements = new Array();
this.elements = [];
this.dW = 0; //column gap, gap width
this.dH = 0; //row gap, gap height
......@@ -93,7 +93,7 @@ CMathBase.prototype =
for(var j=0; j < this.nRow; j++)
{
this.elements[j] = new Array();
this.elements[j] = [];
this.alignment.hgt[j] = MCJC_CENTER;
}
......
......@@ -26,7 +26,7 @@ function CBorderBox(props)
g_oTableId.Add(this, this.Id);
}
extend(CBorderBox, CMathBase);
Asc.extendClass(CBorderBox, CMathBase);
CBorderBox.prototype.init = function(props)
{
this.setProperties(props);
......@@ -445,7 +445,7 @@ function CBox(props)
g_oTableId.Add( this, this.Id );
}
extend(CBox, CMathBase);
Asc.extendClass(CBox, CMathBase);
CBox.prototype.init = function(props)
{
this.setProperties(props);
......@@ -602,7 +602,7 @@ function CBar(props)
g_oTableId.Add( this, this.Id );
}
extend(CBar, CCharacter);
Asc.extendClass(CBar, CCharacter);
CBar.prototype.init = function(props)
{
this.setProperties(props);
......@@ -738,7 +738,7 @@ function CPhantom(props)
g_oTableId.Add( this, this.Id );
}
extend(CPhantom, CMathBase);
Asc.extendClass(CPhantom, CMathBase);
CPhantom.prototype.init = function(props)
{
this.setProperties(props);
......
......@@ -20,7 +20,7 @@ function CDegree(props, bInside)
g_oTableId.Add( this, this.Id );
}
extend(CDegree, CMathBase);
Asc.extendClass(CDegree, CMathBase);
CDegree.prototype.init = function(props)
{
this.setProperties(props);
......@@ -332,7 +332,7 @@ function CIterators()
this.upper = 0; // смещение сверху для позиции основания
CMathBase.call(this, true);
}
extend(CIterators, CMathBase);
Asc.extendClass(CIterators, CMathBase);
CIterators.prototype.init = function()
{
this.setDimension(2, 1);
......@@ -497,7 +497,7 @@ function CDegreeSubSup(props, bInside)
g_oTableId.Add( this, this.Id );
}
extend(CDegreeSubSup, CMathBase);
Asc.extendClass(CDegreeSubSup, CMathBase);
CDegreeSubSup.prototype.init = function(props)
{
this.setProperties(props);
......
......@@ -19,7 +19,7 @@ function CFraction(props)
g_oTableId.Add( this, this.Id );
}
extend(CFraction, CMathBase);
Asc.extendClass(CFraction, CMathBase);
CFraction.prototype.init = function(props)
{
this.setProperties(props);
......@@ -475,7 +475,7 @@ function CNumerator()
this.init();
}
extend(CNumerator, CMathBase);
Asc.extendClass(CNumerator, CMathBase);
CNumerator.prototype.init = function()
{
this.setDimension(1, 1);
......@@ -533,7 +533,7 @@ function CDenominator()
this.init();
}
extend(CDenominator, CMathBase);
Asc.extendClass(CDenominator, CMathBase);
CDenominator.prototype.init = function()
{
this.setDimension(1, 1);
......
......@@ -21,22 +21,12 @@ function CLimit(props)
g_oTableId.Add( this, this.Id );
}
extend(CLimit, CMathBase);
Asc.extendClass(CLimit, CMathBase);
CLimit.prototype.init = function(props)
{
// посмотреть GetAllFonts
this.setProperties(props);
}
CLimit.prototype.getAscent = function()
{
var ascent;
if(this.Pr.type == LIMIT_LOW)
ascent = this.elements[0][0].size.ascent;
else if(this.Pr.type == LIMIT_UP)
ascent = this.elements[0][0].size.height + this.dH + this.elements[1][0].size.ascent;
return ascent;
}
CLimit.prototype.getFName = function()
{
return this.FName;
......@@ -74,7 +64,7 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true)
{
if(RPI.bInline == true)
if(RPI.bInline == true && RPI.bMathFunc == true)
{
this.setDimension(1, 1);
......@@ -122,21 +112,70 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
}
if(RPI.bInline == true)
if(RPI.bInline == true && RPI.bMathFunc == true)
{
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.size =
{
width: this.elements[0][0].size.width,
height: this.elements[0][0].size.height,
ascent: this.elements[0][0].size.ascent
};
}
else
{
//this.setDistance();
this.FName.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ArgSzIter = ArgSize.Copy();
ArgSzIter.decrease();
this.Iterator.Resize(oMeasure, this, ParaMath, RPI, ArgSzIter);
var SizeFName = this.FName.size,
SizeIter = this.Iterator.size;
var width = SizeFName.width > SizeIter.width ? SizeFName.width : SizeIter.width,
height = SizeFName.height + SizeIter.height + this.dH,
ascent;
if(this.Pr.type == LIMIT_LOW)
ascent = SizeFName.ascent;
else if(this.Pr.type == LIMIT_UP)
ascent = SizeIter.height + this.dH + SizeFName.ascent;
width += this.GapLeft + this.GapRight;
/*var width = 0;
var height = 0;
var maxWH = this.getWidthsHeights();
this.setDistance();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
for( var j = 0 ; j < this.nRow; j++ )
height += Heights[j];
height += this.dH*(this.nRow - 1);
for(var i=0; i < this.nCol ; i++)
width += Widths[i];
width += this.dW*(this.nCol - 1) + this.GapLeft + this.GapRight;
var ascent = this.getAscent(oMeasure);*/
this.size = {width: width, height: height, ascent: ascent};
}
this.recalculateSize(oMeasure);
}
CLimit.prototype.getPropsForWrite = function()
{
......@@ -193,12 +232,21 @@ function CMathFunc(props)
g_oTableId.Add( this, this.Id );
}
extend(CMathFunc, CMathBase);
Asc.extendClass(CMathFunc, CMathBase);
CMathFunc.prototype.init = function(props)
{
this.setProperties(props);
this.fillContent();
}
CMathFunc.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
RPI.bMathFunc = true;
CMathFunc.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
RPI.bMathFunc = false;
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.Get_CompiledCtrPrp().FontSize/6*g_dKoef_pt_to_mm;
......
......@@ -42,6 +42,7 @@ function CRPI()
this.bChangeInline = false;
this.bNaryInline = false; /*для CDegreeSupSub внутри N-арного оператора, этот флаг необходим, чтобы итераторы максимально близко друг к другу расположить*/
this.bEqqArray = false; /*для амперсанда*/
this.bMathFunc = false;
}
CRPI.prototype.Copy = function()
......@@ -53,15 +54,11 @@ CRPI.prototype.Copy = function()
RPI.bChangeInline = this.bChangeInline;
RPI.bNaryInline = this.bNaryInline;
RPI.bEqqArray = this.bEqqArray;
RPI.bMathFunc = this.bMathFunc;
return RPI;
}
/*function CMathPosInfo()
{
this.Widths = [];
this.Points = [];
}*/
function CMathPosInfo()
{
......@@ -90,39 +87,7 @@ CMathPosInfo.prototype.UpdatePoint = function()
this.bEven = true;
}
}
CMathPosInfo.prototype.old_old_ApplyAlign = function()
{
var align = 0;
if(this.bEven)
{
var alignEven, alignGeneral;
var Len = this.ContentPoints.length,
Point = this.ContentPoints[this.CurrPoint];
var GWidth = this.GWidths[this.CurrPoint],
GPoint = this.GPoints[this.CurrPoint];
if(this.CurrPoint == Len - 1 && Point.odd == -1) // то есть последняя точка четная, выравнивание по центру
{
alignGeneral = (GWidth - Point.even)/2;
alignEven = 0;
}
else
{
alignEven = (GWidth - GPoint.even - GPoint.odd)/2;
alignGeneral = GPoint.even - Point.even;
}
align = alignGeneral + alignEven;
}
this.x += align;
}
CMathPosInfo.prototype.ApplyAlign = function() // нормальный расчет, без случая с Last элементом
CMathPosInfo.prototype.ApplyAlign = function()
{
var align = 0;
......@@ -136,61 +101,16 @@ CMathPosInfo.prototype.ApplyAlign = function() // нормальный расч
var GWidth = this.GWidths[this.CurrPoint],
GPoint = this.GPoints[this.CurrPoint];
if(this.CurrPoint == Len - 1 && Point.odd == -1) // то есть последняя точка четная, выравнивание по центру
{
alignGeneral = (GWidth - Point.even)/2;
alignEven = 0;
}
else
{
alignGeneral = (GWidth - GPoint.even - GPoint.odd)/2;
alignEven = GPoint.even - Point.even;
}
if(this.CurrPoint > 0)
{
var PrevGenPoint = this.GPoints[this.CurrPoint-1],
PrevGenWidth = this.GWidths[this.CurrPoint-1],
PrevPoint = this.ContentPoints[this.CurrPoint-1];
var alignPrevGen = (PrevGenWidth - PrevGenPoint.even - PrevGenPoint.odd)/2;
alignOdd = alignPrevGen + PrevGenPoint.odd - PrevPoint.odd;
}
else
alignOdd = 0;
align = alignGeneral + alignEven + alignOdd;
}
this.x += align;
}
CMathPosInfo.prototype.new_ApplyAlign = function()
{
var align = 0;
if(this.bEven)
{
var alignEven, alignGeneral, alignOdd;
var Len = this.ContentPoints.length,
Point = this.ContentPoints[this.CurrPoint];
var GWidth = this.GWidths[this.CurrPoint],
GPoint = this.GPoints[this.CurrPoint];
if(this.CurrPoint == Len - 1 && Point.odd == -1) // то есть последняя точка четная, выравнивание по центру
{
var GMaxDimWidth = this.GMaxDimWidths[this.CurrPoint];
alignGeneral = (GMaxDimWidth - Point.even)/2; // для Last элемента
alignGeneral = (GMaxDimWidth - Point.even)/2;
alignEven = 0;
}
else
{
alignGeneral = (GWidth - GPoint.even - GPoint.odd)/2; // для случая, когда у Last элемента максимальная ширина для данного отрезка выравнивания
//alignGeneral = (GWidth - Point.even - Point.odd)/2;
alignGeneral = (GWidth - GPoint.even - GPoint.odd)/2;
alignEven = GPoint.even - Point.even;
}
......@@ -200,7 +120,7 @@ CMathPosInfo.prototype.new_ApplyAlign = function()
PrevGenWidth = this.GWidths[this.CurrPoint-1],
PrevPoint = this.ContentPoints[this.CurrPoint-1];
var alignPrevGen = (PrevGenWidth - PrevPoint.even - PrevPoint.odd)/2;
var alignPrevGen = (PrevGenWidth - PrevGenPoint.even - PrevGenPoint.odd)/2;
alignOdd = alignPrevGen + PrevGenPoint.odd - PrevPoint.odd;
}
else
......@@ -227,50 +147,6 @@ function AmperWidths()
this.bEven = true; // является ли текущая точка нечетной
this.Widths = [];
}
/*AmperWidths.prototype.UpdatePoints = function(value)
{
if(this.bEven)
{
this.CurrPoint++;
var NewPoint = new CMathPoint();
NewPoint.even = value;
this.Widths.push(NewPoint);
this.bEven = false;
}
else
{
var len = this.Widths.length;
this.Widths[len-1].odd = value;
this.bEven = true;
}
}
AmperWidths.prototype.AddToCurrentPoint = function(value)
{
var len = this.Widths.length;
if(len == 0)
{
this.UpdatePoints(value);
this.bEven = true;
}
else
{
if(this.bEven) // текущая точка нечетная
{
if(this.Widths[len-1].even != -1)
this.Widths[len-1].even += value;
else
this.Widths[len-1].even = value;
}
else // текущая точка четная
{
if(this.Widths[len-1].odd != -1)
this.Widths[len-1].odd += value;
else
this.Widths[len-1].odd = value;
}
}
}*/
AmperWidths.prototype.UpdatePoint = function(value)
{
var len = this.Widths.length;
......@@ -455,10 +331,6 @@ CMathArgSize.prototype =
}
}
// TODO
// проконтролировать GapLeft и GapRight для setPosition всех элементов
function CMathGapsInfo(oMeasure, Parent, argSize)
{
this.measure = oMeasure;
......@@ -4104,10 +3976,8 @@ CMathContent.prototype =
this.Parent = Parent;
}
var GapsInfo = new CMathGapsInfo(oMeasure, this, this.Compiled_ArgSz.value);
if (!this.bRoot && this.content.length == 0)
this.fillPlaceholders();
......@@ -4119,10 +3989,6 @@ CMathContent.prototype =
this.size.SetZero();
/*var bManyRuns = RPI.bEqqArray == true && this.content.length > 1;
if(bManyRuns)
var temp = true;*/
this.WidthPoints = new AmperWidths();
for(var pos = 0; pos < lng; pos++)
......@@ -4305,16 +4171,6 @@ CMathContent.prototype =
this.pos.x = PosInfo.x;
this.pos.y = PosInfo.y;
/*var x = pos.x,
y = pos.y + this.size.ascent; */
//this.WidthPoints.CurrPoint = 0;
//this.WidthPoints.Amp = 1;
/*var NewPos = new CMathPosition();
NewPos.x = pos.x;
NewPos.y = pos.y + this.size.ascent; // y по baseline;*/
var NewPosInfo = new CMathPosInfo();
NewPosInfo.x = this.pos.x;
NewPosInfo.y = this.pos.y + this.size.ascent;
......@@ -4329,6 +4185,11 @@ CMathContent.prototype =
NewPosInfo.ApplyAlign();
}
var ConsoleY = PosInfo.y + this.size.ascent,
id = this.Id;
console.log("" + id + " : " + ConsoleY);
for(var i=0; i < this.content.length; i++)
{
......@@ -4339,10 +4200,6 @@ CMathContent.prototype =
}
else
{
/*var NewPos = new CMathPosition();
NewPos.x = pos.x;
NewPos.y = pos.y + this.size.ascent; // y по baseline;*/
this.content[i].setPosition(NewPosInfo);
NewPosInfo.UpdateX(this.content[i].size.width);
}
......@@ -4360,35 +4217,10 @@ CMathContent.prototype =
this.plhHide = flag;
},
///////// RunPrp, CtrPrp
old_getFirstRPrp: function(ParaMath)
{
//var rPrp = new CMathRunPrp();
var rPrp = new CTextPr();
var defaultRPrp = ParaMath.Get_Default_TPrp();
rPrp.Merge(defaultRPrp);
if(this.content.length > 1)
{
// первый объект всегда para_Math_Run
this.content[0].Get_CompiledPr(true);
}
return rPrp;
},
getFirstRPrp: function(ParaMath)
{
return this.content[0].Get_CompiledPr(true);
},
/*increaseArgSize: function()
{
if(this.argSize < 2)
this.argSize++;
},
decreaseArgSize: function()
{
if( this.argSize > -2 )
this.argSize--;
},*/
GetCtrPrp: function() // for placeholder
{
var ctrPrp = new CTextPr();
......
......@@ -25,7 +25,7 @@ function CMathMatrix(props)
rSp: 0,
rSpRule: 0,
mcs: new Array(),
mcs: [],
baseJc: BASEJC_CENTER,
plcHide: false
};
......@@ -45,7 +45,7 @@ function CMathMatrix(props)
g_oTableId.Add( this, this.Id );
}
extend(CMathMatrix, CMathBase);
Asc.extendClass(CMathMatrix, CMathBase);
CMathMatrix.prototype.init = function(props)
{
this.setProperties(props);
......@@ -673,7 +673,7 @@ function CEqArray(props)
rSp: 0,
rSpRule: 0,
mcs: new Array(),
mcs: [],
baseJc: BASEJC_CENTER,
plcHide: false
};
......@@ -703,7 +703,7 @@ function CEqArray(props)
g_oTableId.Add( this, this.Id );
}
extend(CEqArray, CMathMatrix);
Asc.extendClass(CEqArray, CMathMatrix);
CEqArray.prototype.init = function(props)
{
this.setProperties(props);
......@@ -734,7 +734,7 @@ CEqArray.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
//CEqArray.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
}
CEqArray.prototype._getMetrics = function(RPI)
CEqArray.prototype.getMetrics = function(RPI)
{
var AscentsMetrics = [];
var DescentsMetrics = [];
......@@ -755,6 +755,7 @@ CEqArray.prototype._getMetrics = function(RPI)
this.WidthsPoints.length = 0;
this.Points.length = 0;
this.MaxDimWidths.length = 0;
WidthsMetrics[0] = 0;
......@@ -780,7 +781,6 @@ CEqArray.prototype._getMetrics = function(RPI)
{
maxDim = WidthsRow[Pos].even < WidthsRow[Pos].odd ? WidthsRow[Pos].odd : WidthsRow[Pos].even;
maxDimWidth = WidthsRow[Pos].even + WidthsRow[Pos].odd;
//this.WidthsPoints[Pos] = WidthsRow[Pos].even + WidthsRow[Pos].odd;
}
even = even > WidthsRow[Pos].even ? even : WidthsRow[Pos].even; // before "odd"
odd = odd > WidthsRow[Pos].odd ? odd : WidthsRow[Pos].odd; // after "odd"
......@@ -791,7 +791,6 @@ CEqArray.prototype._getMetrics = function(RPI)
{
maxDim = WidthsRow[Pos].even;
maxDimWidth = maxDim;
//this.WidthsPoints[Pos] = maxDim;
}
last = last > WidthsRow[Pos].even ? last: WidthsRow[Pos].even;
}
......@@ -799,12 +798,6 @@ CEqArray.prototype._getMetrics = function(RPI)
if(Pos == len - 1)
EndWidths++;
}
/*if(Pos == len && len == 0) // для контентов без точек выравнивания
{
last =
EndWidths++;
}*/
}
var w = even + odd > last ? even + odd : last;
......@@ -822,18 +815,6 @@ CEqArray.prototype._getMetrics = function(RPI)
Pos++;
}
/*if(true)
{
var str = "";
for(var i = 0; i < this.WidthsPoints.length; i++)
{
var num = this.WidthsPoints[i].toFixed(3);
str += num + " ";
}
console.log(str);
}*/
for(var i = 0; i < this.nRow; i++)
{
......@@ -862,242 +843,6 @@ CEqArray.prototype._getMetrics = function(RPI)
return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics};
}
CEqArray.prototype.getMetrics = function(RPI) // нормальный расчет, без случая с Last элементом
{
var AscentsMetrics = [];
var DescentsMetrics = [];
var WidthsMetrics = [];
// нумерация начинается с нуля, поэтому все четные точки идут с нечетными номерами в массиве
//var lngW = RPI.Widths.length; // this.nRow
var EndWidths = 0;
var even, // четная точка
odd, // нечетная точка
last;
var Pos = 0;
this.WidthsPoints.length = 0;
this.Points.length = 0;
WidthsMetrics[0] = 0;
while(EndWidths < this.nRow)
{
even = 0;
odd = 0;
last = 0;
for(var i = 0; i < this.nRow; i++)
{
var WidthsRow = this.elements[i][0].WidthPoints.Widths,
len = WidthsRow.length;
if(Pos < len)
{
if(WidthsRow[Pos].odd !== -1)
{
even = even > WidthsRow[Pos].even ? even : WidthsRow[Pos].even; // before "odd"
odd = odd > WidthsRow[Pos].odd ? odd : WidthsRow[Pos].odd; // after "odd"
}
else
{
last = last > WidthsRow[Pos].even ? last: WidthsRow[Pos].even;
}
if(Pos == len - 1)
EndWidths++;
}
/*if(Pos == len && len == 0) // для контентов без точек выравнивания
{
last =
EndWidths++;
}*/
}
var w = even + odd > last ? even + odd : last;
var NewPoint = new CMathPoint();
NewPoint.even = even;
NewPoint.odd = odd;
this.WidthsPoints.push(w);
this.Points.push(NewPoint);
WidthsMetrics[0] += w;
Pos++;
}
/*if(true)
{
var str = "";
for(var i = 0; i < this.WidthsPoints.length; i++)
{
var num = this.WidthsPoints[i].toFixed(3);
str += num + " ";
}
console.log(str);
}*/
for(var i = 0; i < this.nRow; i++)
{
var size = this.elements[i][0].size;
AscentsMetrics[i] = size.ascent;
DescentsMetrics[i] = size.height - size.ascent;
}
/*for(var tt = 0; tt < this.nCol; tt++ )
Widths[tt] = 0;
for(var i=0; i < this.nRow; i++)
{
Ascents[i] = 0;
Descents[i] = 0;
for(var j = 0; j < this.nCol ; j++)
{
var size = this.elements[i][j].size;
Widths[j] = i > 0 && ( Widths[j] > size.width ) ? Widths[j] : size.width;
Ascents[i] = (Ascents[i] > size.ascent ) ? Ascents[i] : size.ascent;
Descents[i] = (Descents[i] > size.height - size.ascent ) ? Descents[i] : size.height - size.ascent;
}
}*/
return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics};
}
CEqArray.prototype.new_getMetrics = function(RPI)
{
var AscentsMetrics = [];
var DescentsMetrics = [];
var WidthsMetrics = [];
// нумерация начинается с нуля, поэтому все четные точки идут с нечетными номерами в массиве
//var lngW = RPI.Widths.length; // this.nRow
var EndWidths = 0;
var even, // четная точка
odd, // нечетная точка
last,
maxDim;
var Pos = 0;
this.WidthsPoints.length = 0;
this.Points.length = 0;
WidthsMetrics[0] = 0;
while(EndWidths < this.nRow)
{
even = 0;
odd = 0;
last = 0;
maxDim = 0;
for(var i = 0; i < this.nRow; i++)
{
var WidthsRow = this.elements[i][0].WidthPoints.Widths,
len = WidthsRow.length;
if(Pos < len)
{
if(WidthsRow[Pos].odd !== -1)
{
if(maxDim < WidthsRow[Pos].even || maxDim < WidthsRow[Pos].odd)
{
maxDim = WidthsRow[Pos].even < WidthsRow[Pos].odd ? WidthsRow[Pos].odd : WidthsRow[Pos].even;
this.WidthsPoints[Pos] = WidthsRow[Pos].even + WidthsRow[Pos].odd;
}
even = even > WidthsRow[Pos].even ? even : WidthsRow[Pos].even; // before "odd"
odd = odd > WidthsRow[Pos].odd ? odd : WidthsRow[Pos].odd; // after "odd"
}
else
{
if(maxDim < WidthsRow[Pos].even)
{
maxDim = WidthsRow[Pos].even;
this.WidthsPoints[Pos] = maxDim;
}
last = last > WidthsRow[Pos].even ? last: WidthsRow[Pos].even;
}
if(Pos == len - 1)
EndWidths++;
}
/*if(Pos == len && len == 0) // для контентов без точек выравнивания
{
last =
EndWidths++;
}*/
}
var w = even + odd > last ? even + odd : last;
var NewPoint = new CMathPoint();
NewPoint.even = even;
NewPoint.odd = odd;
//this.WidthsPoints.push(w);
this.Points.push(NewPoint);
WidthsMetrics[0] += w;
Pos++;
}
/*if(true)
{
var str = "";
for(var i = 0; i < this.WidthsPoints.length; i++)
{
var num = this.WidthsPoints[i].toFixed(3);
str += num + " ";
}
console.log(str);
}*/
for(var i = 0; i < this.nRow; i++)
{
var size = this.elements[i][0].size;
AscentsMetrics[i] = size.ascent;
DescentsMetrics[i] = size.height - size.ascent;
}
/*for(var tt = 0; tt < this.nCol; tt++ )
Widths[tt] = 0;
for(var i=0; i < this.nRow; i++)
{
Ascents[i] = 0;
Descents[i] = 0;
for(var j = 0; j < this.nCol ; j++)
{
var size = this.elements[i][j].size;
Widths[j] = i > 0 && ( Widths[j] > size.width ) ? Widths[j] : size.width;
Ascents[i] = (Ascents[i] > size.ascent ) ? Ascents[i] : size.ascent;
Descents[i] = (Descents[i] > size.height - size.ascent ) ? Descents[i] : size.height - size.ascent;
}
}*/
return {ascents: AscentsMetrics, descents: DescentsMetrics, widths: WidthsMetrics};
}
CEqArray.prototype.setPosition = function(pos)
{
//PosInfo.Widths = this.WidthsPoints;
......@@ -1141,7 +886,7 @@ CEqArray.prototype.setProperties = function(props)
if(props.objDist !== "undefined" && props.objDist !== null)
this.Pr.objDist = props.objDist;
var mcs = new Array();
var mcs = [];
mcs.push(new CMColumsPr());
var Pr =
......
......@@ -33,7 +33,7 @@ function CNary(props)
g_oTableId.Add( this, this.Id );
}
extend(CNary, CMathBase);
Asc.extendClass(CNary, CMathBase);
CNary.prototype.init = function(props)
{
this.setProperties(props);
......@@ -463,7 +463,7 @@ function CNaryUnd(bInside)
this.setDimension(2, 1);
//this.init();
}
extend(CNaryUnd, CMathBase);
Asc.extendClass(CNaryUnd, CMathBase);
/*CNaryUnd.prototype.old_init = function()
{
this.setDimension(2,1);
......@@ -516,7 +516,7 @@ function CNaryOvr(bInside)
this.setDimension(2, 1);
}
extend(CNaryOvr, CMathBase);
Asc.extendClass(CNaryOvr, CMathBase);
/*CNaryOvr.prototype.old_init = function()
{
this.setDimension(2,1);
......@@ -591,7 +591,7 @@ function CNaryUndOvr(bInside)
this.setDimension(3,1);
}
extend(CNaryUndOvr, CMathBase);
Asc.extendClass(CNaryUndOvr, CMathBase);
/*CNaryUndOvr.prototype.old_init = function(oSign)
{
this.setDimension(3,1);
......@@ -810,7 +810,7 @@ function CSigma()
{
CNaryOperator.call(this);
}
extend(CSigma, CNaryOperator);
Asc.extendClass(CSigma, CNaryOperator);
CSigma.prototype.drawPath = function(pGraphics, XX, YY)
{
pGraphics._m(XX[0], YY[0]);
......@@ -1011,7 +1011,7 @@ function CProduct(bFlip)
{
CNaryOperator.call(this, bFlip);
}
extend(CProduct, CNaryOperator);
Asc.extendClass(CProduct, CNaryOperator);
CProduct.prototype.drawPath = function(pGraphics, XX, YY)
{
pGraphics._m(XX[0], YY[0]);
......@@ -1176,7 +1176,7 @@ function CUnion(bFlip)
{
CNaryOperator.call(this, bFlip);
}
extend(CUnion, CNaryOperator);
Asc.extendClass(CUnion, CNaryOperator);
CUnion.prototype.drawPath = function(pGraphics, XX, YY)
{
pGraphics._m(XX[0], YY[0]);
......@@ -1245,7 +1245,7 @@ function CLogicalOr(bFlip)
{
CNaryOperator.call(this, bFlip);
}
extend(CLogicalOr, CNaryOperator);
Asc.extendClass(CLogicalOr, CNaryOperator);
CLogicalOr.prototype.drawPath = function(pGraphics, XX, YY)
{
pGraphics._m(XX[0], YY[0]);
......@@ -1397,7 +1397,7 @@ function CIntegral()
{
CNaryOperator.call(this);
}
extend(CIntegral, CNaryOperator);
Asc.extendClass(CIntegral, CNaryOperator);
CIntegral.prototype.getCoord = function()
{
var X = [],
......@@ -1627,7 +1627,7 @@ function CDoubleIntegral()
{
CIntegral.call(this);
}
extend(CDoubleIntegral, CIntegral);
Asc.extendClass(CDoubleIntegral, CIntegral);
CDoubleIntegral.prototype.drawPath = function(pGraphics, XX, YY)
{
// XX[9] - ширина
......@@ -1668,7 +1668,7 @@ function CTripleIntegral()
{
CIntegral.call(this);
}
extend(CTripleIntegral, CIntegral);
Asc.extendClass(CTripleIntegral, CIntegral);
CTripleIntegral.prototype.drawPath = function(pGraphics, XX, YY)
{
// XX[9] - ширина
......@@ -2046,7 +2046,7 @@ function CContourIntegral()
{
CNaryOperator.call(this);
}
extend(CContourIntegral, CNaryOperator);
Asc.extendClass(CContourIntegral, CNaryOperator);
CContourIntegral.prototype.draw = function(x, y, pGraphics)
{
var circle = new CCircle();
......@@ -2132,7 +2132,7 @@ function CSurfaceIntegral()
{
CNaryOperator.call(this);
}
extend(CSurfaceIntegral, CNaryOperator);
Asc.extendClass(CSurfaceIntegral, CNaryOperator);
CSurfaceIntegral.prototype.draw = function(x, y, pGraphics)
{
var surf = new CSurface();
......@@ -2216,7 +2216,7 @@ function CVolumeIntegral()
{
CNaryOperator.call(this);
}
extend(CVolumeIntegral, CNaryOperator);
Asc.extendClass(CVolumeIntegral, CNaryOperator);
CVolumeIntegral.prototype.draw = function(x, y, pGraphics)
{
var volume = new CVolume();
......
......@@ -416,7 +416,7 @@ function COperatorBracket()
{
CGlyphOperator.call(this);
}
extend(COperatorBracket, CGlyphOperator);
Asc.extendClass(COperatorBracket, CGlyphOperator);
COperatorBracket.prototype.calcSize = function( stretch )
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -934,7 +934,7 @@ function COperatorParenthesis()
{
CGlyphOperator.call(this);
}
extend(COperatorParenthesis, CGlyphOperator);
Asc.extendClass(COperatorParenthesis, CGlyphOperator);
COperatorParenthesis.prototype.calcSize = function(stretch)
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1065,7 +1065,7 @@ function COperatorAngleBracket()
{
CGlyphOperator.call(this);
}
extend(COperatorAngleBracket, CGlyphOperator);
Asc.extendClass(COperatorAngleBracket, CGlyphOperator);
COperatorAngleBracket.prototype.calcSize = function(stretch)
{
//скобка перевернутая
......@@ -1176,7 +1176,7 @@ function CSquareBracket()
{
CGlyphOperator.call(this);
}
extend(CSquareBracket, CGlyphOperator);
Asc.extendClass(CSquareBracket, CGlyphOperator);
CSquareBracket.prototype.calcCoord = function(stretch)
{
var X = [],
......@@ -1247,7 +1247,7 @@ function CHalfSquareBracket()
{
CGlyphOperator.call(this);
}
extend(CHalfSquareBracket, CGlyphOperator);
Asc.extendClass(CHalfSquareBracket, CGlyphOperator);
CHalfSquareBracket.prototype.calcCoord = function(stretch)
{
var X = [],
......@@ -1315,7 +1315,7 @@ function COperatorLine()
{
CGlyphOperator.call(this);
}
extend(COperatorLine, CGlyphOperator);
Asc.extendClass(COperatorLine, CGlyphOperator);
COperatorLine.prototype.setContent = function()
{
COperatorLine.superclass.setContent.call(this, this.calcSize, this.calcCoord, this.drawPath);
......@@ -1383,7 +1383,7 @@ function CWhiteSquareBracket()
{
CGlyphOperator.call(this);
}
extend(CWhiteSquareBracket, CGlyphOperator);
Asc.extendClass(CWhiteSquareBracket, CGlyphOperator);
CWhiteSquareBracket.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1482,7 +1482,7 @@ function COperatorDoubleLine()
{
CGlyphOperator.call(this);
}
extend(COperatorDoubleLine, CGlyphOperator);
Asc.extendClass(COperatorDoubleLine, CGlyphOperator);
COperatorDoubleLine.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1559,7 +1559,7 @@ function CSingleArrow()
{
CGlyphOperator.call(this);
}
extend(CSingleArrow, CGlyphOperator);
Asc.extendClass(CSingleArrow, CGlyphOperator);
CSingleArrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1635,7 +1635,7 @@ function CLeftRightArrow()
{
CGlyphOperator.call(this);
}
extend(CLeftRightArrow, CGlyphOperator);
Asc.extendClass(CLeftRightArrow, CGlyphOperator);
CLeftRightArrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1724,7 +1724,7 @@ function CDoubleArrow()
{
CGlyphOperator.call(this);
}
extend(CDoubleArrow, CGlyphOperator);
Asc.extendClass(CDoubleArrow, CGlyphOperator);
CDoubleArrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1823,7 +1823,7 @@ function CLR_DoubleArrow()
{
CGlyphOperator.call(this);
}
extend(CLR_DoubleArrow, CGlyphOperator);
Asc.extendClass(CLR_DoubleArrow, CGlyphOperator);
CLR_DoubleArrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -1934,7 +1934,7 @@ function CCombiningArrow()
{
CGlyphOperator.call(this);
}
extend(CCombiningArrow, CGlyphOperator);
Asc.extendClass(CCombiningArrow, CGlyphOperator);
CCombiningArrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -2004,7 +2004,7 @@ function CCombiningHalfArrow()
{
CGlyphOperator.call(this);
}
extend(CCombiningHalfArrow, CGlyphOperator);
Asc.extendClass(CCombiningHalfArrow, CGlyphOperator);
CCombiningHalfArrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -2070,7 +2070,7 @@ function CCombining_LR_Arrow()
{
CGlyphOperator.call(this);
}
extend(CCombining_LR_Arrow, CGlyphOperator);
Asc.extendClass(CCombining_LR_Arrow, CGlyphOperator);
CCombining_LR_Arrow.prototype.calcSize = function()
{
var betta = this.getCtrPrp().FontSize/36;
......@@ -3277,7 +3277,7 @@ function CDelimiter(props)
g_oTableId.Add( this, this.Id );
}
extend(CDelimiter, CMathBase);
Asc.extendClass(CDelimiter, CMathBase);
CDelimiter.prototype.init = function(props)
{
this.setProperties(props);
......@@ -3916,7 +3916,7 @@ function CCharacter()
CMathBase.call(this);
}
extend(CCharacter, CMathBase);
Asc.extendClass(CCharacter, CMathBase);
CCharacter.prototype.setCharacter = function(props, defaultProps)
{
this.operator.mergeProperties(props, defaultProps);
......@@ -4049,7 +4049,7 @@ function CGroupCharacter(props)
/// вызов этой функции обязательно в конце
g_oTableId.Add( this, this.Id );
}
extend(CGroupCharacter, CCharacter);
Asc.extendClass(CGroupCharacter, CCharacter);
CGroupCharacter.prototype.init = function(props)
{
......
......@@ -912,7 +912,7 @@ function CRadical(props)
g_oTableId.Add( this, this.Id );
}
extend(CRadical, CMathBase);
Asc.extendClass(CRadical, CMathBase);
CRadical.prototype.init = function(props)
{
this.setProperties(props);
......
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