Commit 3f323879 authored by Anna.Pavlova's avatar Anna.Pavlova Committed by Alexander.Trofimov

1. Поправила баг для N-арных операторов (когда основание CDegree с одним...

1. Поправила баг для N-арных операторов (когда основание CDegree с одним итератором) в inline-форумле,
на пересчете возникала ошибка, размер не рассчитывался : возникал в связи с тем, что оператор задается через CMathText,
а в этом классе не определена ф-ия IsOnlyText
2. Уменьшила ArgSize для No Bar Fraction (поправила). Как следствие переделала порядок вызова функций Resize, Apply_Gaps
3. Поправила баг с minGap для матрицы
4. Поправила вычисление смещения позиции для CGroupCharacter
5. Поправила баг для CGroupCharacter (если бейзлайн GroupCharacter идет 
по бейзлайну оператора, то тогда ArgSize контента уменьшается)
6. Поправила баг для N-арных операторов в inline-формулах, когда limLoс при чтении файла не был определен, 
не правильный порядок операторов был у N-арного оператора, брался дефолтовый (UndOvr)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57733 954022d7-b5bf-4e40-9824-e11837661b57
parent 75e93642
...@@ -7768,10 +7768,10 @@ ParaRun.prototype.getPropsForWrite = function() ...@@ -7768,10 +7768,10 @@ ParaRun.prototype.getPropsForWrite = function()
return {wRPrp: wRPrp, mathRPrp: mathRPrp}; return {wRPrp: wRPrp, mathRPrp: mathRPrp};
} }
ParaRun.prototype.Math_SetGaps = function(Parent, Paragraph, GapsInfo) ParaRun.prototype.Math_SetGaps = function(GapsInfo)
{ {
this.Parent = Parent; //this.Parent = Parent;
this.Paragraph = Paragraph; //this.Paragraph = Paragraph;
var oWPrp = this.Get_CompiledPr(true); var oWPrp = this.Get_CompiledPr(true);
//this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.argSize); //this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.argSize);
...@@ -7817,6 +7817,14 @@ ParaRun.prototype.IsAccent = function() ...@@ -7817,6 +7817,14 @@ ParaRun.prototype.IsAccent = function()
{ {
return this.Parent.IsAccent(); return this.Parent.IsAccent();
} }
ParaRun.prototype.Math_ApplyGaps = function()
{
for (var Pos = 0 ; Pos < this.Content.length; Pos++ )
{
this.Content[Pos].ApplyGaps();
this.size.width += this.Content[Pos].GapLeft + this.Content[Pos].GapRight;
}
}
function CParaRunStartState(Run) function CParaRunStartState(Run)
......
...@@ -1103,6 +1103,8 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -1103,6 +1103,8 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps == true) if(this.RecalcInfo.bProps == true)
{ {
var prp = var prp =
...@@ -1118,6 +1120,8 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -1118,6 +1120,8 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
}; };
this.operator.mergeProperties(prp, defaultPrp); this.operator.mergeProperties(prp, defaultPrp);
this.RecalcInfo.bProps = false;
} }
this.operator.relate(this); this.operator.relate(this);
......
...@@ -116,7 +116,7 @@ CMathBase.prototype = ...@@ -116,7 +116,7 @@ CMathBase.prototype =
return CtrPrp; return CtrPrp;
}, },
Set_CompiledCtrPrp: function(ParaMath) /*Set_CompiledCtrPrp: function(ParaMath)
{ {
var defaultRPrp = ParaMath.GetFirstRPrp(); var defaultRPrp = ParaMath.GetFirstRPrp();
...@@ -128,7 +128,7 @@ CMathBase.prototype = ...@@ -128,7 +128,7 @@ CMathBase.prototype =
if(this.elements[i][j].Type === para_Math_Composition) if(this.elements[i][j].Type === para_Math_Composition)
this.elements[i][j].Set_CompiledCtrPrp(ParaMath); this.elements[i][j].Set_CompiledCtrPrp(ParaMath);
}, },*/
Get_CompiledCtrPrp: function() Get_CompiledCtrPrp: function()
{ {
var CompiledCtrPrp; var CompiledCtrPrp;
...@@ -197,16 +197,11 @@ CMathBase.prototype = ...@@ -197,16 +197,11 @@ CMathBase.prototype =
{ {
this.elements[i] = []; this.elements[i] = [];
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
{
this.elements[i][j] = elements[j + i*this.nCol]; this.elements[i][j] = elements[j + i*this.nCol];
//this.elements[i][j].bMObjs = true;
}
} }
} }
else else
{
this.setContent(); this.setContent();
}
}, },
// эта функция здесь необходима для случая с n-арными операторами : когда передаем n-арный оператор с итераторами и аргумент // эта функция здесь необходима для случая с n-арными операторами : когда передаем n-арный оператор с итераторами и аргумент
IsJustDraw: function() IsJustDraw: function()
...@@ -379,19 +374,28 @@ CMathBase.prototype = ...@@ -379,19 +374,28 @@ CMathBase.prototype =
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
for(var i=0; i < this.nRow; i++) for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
this.elements[i][j].Resize(oMeasure, this, ParaMath, RPI, ArgSize); this.elements[i][j].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize(oMeasure, RPI); this.recalculateSize(oMeasure, RPI);
}, },
CompiledCtrPrp: function() Set_CompiledCtrPrp: function(ParaMath)
{ {
if(this.RecalcInfo.bCtrPrp == true) if(this.RecalcInfo.bCtrPrp == true)
{ {
this.Set_CompiledCtrPrp(); var defaultRPrp = ParaMath.GetFirstRPrp();
this.CompiledCtrPrp.Merge(defaultRPrp);
this.CompiledCtrPrp.Merge(this.CtrPrp);
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if(this.elements[i][j].Type === para_Math_Composition)
this.elements[i][j].Set_CompiledCtrPrp(ParaMath);
this.RecalcInfo.bCtrPrp = false; this.RecalcInfo.bCtrPrp = false;
//this.RecalcInfo.bProps = false;
} }
}, },
getAscent: function(oMeasure, _height) getAscent: function(oMeasure, _height)
...@@ -761,10 +765,10 @@ CMathBase.prototype = ...@@ -761,10 +765,10 @@ CMathBase.prototype =
{ {
return this.elements[this.CurPos_X][this.CurPos_Y].IsCurrentPlh(); return this.elements[this.CurPos_X][this.CurPos_Y].IsCurrentPlh();
}, },
SetGaps: function(Parent, ParaMath, GapsInfo) SetGaps: function(GapsInfo)
{ {
this.Parent = Parent; //this.Parent = Parent;
this.ParaMath = ParaMath; //this.ParaMath = ParaMath;
GapsInfo.Left = GapsInfo.Current; GapsInfo.Left = GapsInfo.Current;
GapsInfo.leftRunPrp = GapsInfo.currRunPrp; GapsInfo.leftRunPrp = GapsInfo.currRunPrp;
......
...@@ -458,10 +458,12 @@ CBox.prototype.fillContent = function() ...@@ -458,10 +458,12 @@ CBox.prototype.fillContent = function()
} }
CBox.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CBox.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
this.Set_CompiledCtrPrp(ParaMath);
var ArgSizeBox = ArgSize.Copy(); var ArgSizeBox = ArgSize.Copy();
if(this.Pr.opEmu) /*if(this.Pr.opEmu)
ArgSizeBox.decrease(); ArgSizeBox.decrease();*/
CBox.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSizeBox); CBox.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSizeBox);
} }
...@@ -630,6 +632,8 @@ CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -630,6 +632,8 @@ CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.RecalcInfo.bProps = false; this.RecalcInfo.bProps = false;
} }
this.Set_CompiledCtrPrp(ParaMath);
CBar.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize); CBar.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
} }
CBar.prototype.getAscent = function() CBar.prototype.getAscent = function()
......
...@@ -31,22 +31,13 @@ CDegree.prototype.fillContent = function() ...@@ -31,22 +31,13 @@ CDegree.prototype.fillContent = function()
this.setDimension(1, 2); this.setDimension(1, 2);
this.setContent(); this.setContent();
} }
/*CDegree.prototype.fillContent = function()
{
var oBase = new CMathContent();
this.setDimension(1, 2);
var oDegree = new CMathContent();
oDegree.decreaseArgSize();
this.addMCToContent([oBase, oDegree]);
}*/
CDegree.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CDegree.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize); this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ArgSzDegr = ArgSize.Copy(); var ArgSzDegr = ArgSize.Copy();
...@@ -60,13 +51,6 @@ CDegree.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -60,13 +51,6 @@ CDegree.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.recalculateSubScript(oMeasure); this.recalculateSubScript(oMeasure);
} }
/*CDegree.prototype.recalculateSize = function(oMeasure)
{
if(this.Pr.type === DEGREE_SUPERSCRIPT)
this.recalculateSup(oMeasure);
else if(this.Pr.type === DEGREE_SUBSCRIPT)
this.recalculateSubScript(oMeasure);
}*/
CDegree.prototype.old__recalculateSup = function(oMeasure) CDegree.prototype.old__recalculateSup = function(oMeasure)
{ {
var base = this.elements[0][0].size, var base = this.elements[0][0].size,
...@@ -153,7 +137,8 @@ CDegree.prototype.recalculateSup = function(oMeasure) ...@@ -153,7 +137,8 @@ CDegree.prototype.recalculateSup = function(oMeasure)
this.upBase = 0; this.upBase = 0;
this.upIter = 0; this.upIter = 0;
var bBaseOnlyText = this.elements[0][0].IsOnlyText(); var oBase = this.elements[0][0];
var bBaseOnlyText = oBase.IsJustDraw() ? false : oBase.IsOnlyText(); // у Just-Draw элементов нет ф-ии IsOnlyText
if(bBaseOnlyText) if(bBaseOnlyText)
{ {
...@@ -201,9 +186,9 @@ CDegree.prototype.recalculateSubScript = function(oMeasure) ...@@ -201,9 +186,9 @@ CDegree.prototype.recalculateSubScript = function(oMeasure)
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp); var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
var width = base.width + iter.width + this.dW; var width = base.width + iter.width + this.dW;
//width += this.GapLeft + this.GapRight;
var bBaseOnlyText = this.elements[0][0].IsOnlyText(); var oBase = this.elements[0][0];
var bBaseOnlyText = oBase.IsJustDraw() ? false : oBase.IsOnlyText(); // у Just-Draw элементов нет ф-ии IsOnlyText
if(bBaseOnlyText) if(bBaseOnlyText)
{ {
...@@ -213,9 +198,6 @@ CDegree.prototype.recalculateSubScript = function(oMeasure) ...@@ -213,9 +198,6 @@ CDegree.prototype.recalculateSubScript = function(oMeasure)
this.upIter = 1/4*base.ascent; this.upIter = 1/4*base.ascent;
else else
this.upIter = base.ascent + DownBaseline - iter.ascent; this.upIter = base.ascent + DownBaseline - iter.ascent;
/*if(base.ascent/2 > this.upIter)
this.upIter = base.ascent/2;*/
} }
else else
{ {
...@@ -249,12 +231,6 @@ CDegree.prototype.setPosition = function(pos) ...@@ -249,12 +231,6 @@ CDegree.prototype.setPosition = function(pos)
PosIter.x = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW; PosIter.x = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW;
PosIter.y = this.pos.y + this.upIter; PosIter.y = this.pos.y + this.upIter;
//var x1 = this.pos.x + this.GapLeft,
// y1 = this.pos.y + this.upBase;
//var x2 = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW,
// y2 = this.pos.y + this.upIter;
this.elements[0][0].setPosition(PosBase); this.elements[0][0].setPosition(PosBase);
this.elements[0][1].setPosition(PosIter); this.elements[0][1].setPosition(PosIter);
} }
...@@ -558,6 +534,8 @@ CDegreeSubSup.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSi ...@@ -558,6 +534,8 @@ CDegreeSubSup.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSi
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
var ArgSzIters = ArgSize.Copy(); var ArgSzIters = ArgSize.Copy();
ArgSzIters.decrease(); ArgSzIters.decrease();
......
...@@ -226,11 +226,20 @@ CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -226,11 +226,20 @@ CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.ArgSize.SetValue(-1); // для CtrPrp this.ArgSize.SetValue(-1); // для CtrPrp
} }
if(this.Pr.type == NO_BAR_FRACTION)
{
ArgSzFr.decrease();
this.ArgSize.SetValue(-1);
}
// компилируем CtrPrp после того, как выставим ArgSize
// т.к. при компиляции CtrPrp для дроби важен this.Argsize (NO_BAR_FRACTION)
this.Set_CompiledCtrPrp(ParaMath);
var NewRPI = RPI.Copy(); var NewRPI = RPI.Copy();
NewRPI.bInsideFraction = true; NewRPI.bInsideFraction = true;
CFraction.superclass.Resize.call(this, oMeasure, Parent, ParaMath, NewRPI, ArgSzFr); CFraction.superclass.Resize.call(this, oMeasure, Parent, ParaMath, NewRPI, ArgSzFr);
} }
CFraction.prototype.recalculateSize = function(oMeasure) CFraction.prototype.recalculateSize = function(oMeasure)
{ {
......
...@@ -111,6 +111,8 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -111,6 +111,8 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps == true) if(this.RecalcInfo.bProps == true)
{ {
this.setDimension(2, 1); this.setDimension(2, 1);
...@@ -125,6 +127,8 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -125,6 +127,8 @@ CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.elements[0][0] = this.Iterator; this.elements[0][0] = this.Iterator;
this.elements[1][0] = this.FName; this.elements[1][0] = this.FName;
} }
this.RecalcInfo.bProps = false;
} }
this.FName.Resize(oMeasure, this, ParaMath, RPI, ArgSize); this.FName.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
......
...@@ -591,6 +591,7 @@ function CMPrp() ...@@ -591,6 +591,7 @@ function CMPrp()
this.brk = undefined; this.brk = undefined;
this.lit = undefined; this.lit = undefined;
// Default
/*this.sty = STY_ITALIC; /*this.sty = STY_ITALIC;
this.scr = TXT_ROMAN; this.scr = TXT_ROMAN;
...@@ -694,8 +695,6 @@ CMPrp.prototype = ...@@ -694,8 +695,6 @@ CMPrp.prototype =
this.sty = STY_BOLD; this.sty = STY_BOLD;
else else
this.sty = STY_PLAIN; this.sty = STY_PLAIN;
} }
} }
...@@ -703,18 +702,8 @@ CMPrp.prototype = ...@@ -703,18 +702,8 @@ CMPrp.prototype =
//TODO //TODO
//пересмотреть this.dW и this.dH //пересмотреть this.dW и this.dH
//TODO
//сделать, чтобы курсор выставлялся только, где это действительно необходимо
//в качеcтве позиции для контента передавать положение baseLine для него
// TODO Refactoring
// 1. (!!) повтор IsIncline, IsHighElement
function CMathContent() function CMathContent()
{ {
...@@ -773,32 +762,6 @@ CMathContent.prototype = ...@@ -773,32 +762,6 @@ CMathContent.prototype =
{ {
}, },
/*setArgSize: function(argSize)
{
var check = argSize == 0 || argSize == 1 || argSize == 2 || argSize == -1 || argSize === -2; // проверка параметра
if(check)
{
// складываем здесь, чтобы не потерять собственные настройки argSize: при добавлении в итератор формулы из меню; при добавлении готовых формул, когда есть вложенность формул с итераторами
// не будет работать при копиравнии в случае, если argSize будет отличатся от нуля для копируемой части контента
// поэтому при копировании свойство argSize не учитываем (копируем только массив элекентов вместе с Run Properties)
var val = this.argSize + argSize;
if(val < -2)
this.argSize = -2;
else if(val > 2)
this.argSize = 2;
else
this.argSize = val;
for(var i = 0; i < this.content.length; i++)
{
if(this.content[i].Type == para_Math_Composition)
this.content[i].setArgSize(argSize);
}
}
},*/
addTxt: function(txt) addTxt: function(txt)
{ {
var Pos = this.CurPos; var Pos = this.CurPos;
...@@ -3857,12 +3820,9 @@ CMathContent.prototype = ...@@ -3857,12 +3820,9 @@ CMathContent.prototype =
for(var i = 0; i < this.content.length; i++) for(var i = 0; i < this.content.length; i++)
{ {
if(this.content[i].Type == para_Math_Composition) if(this.content[i].Type == para_Math_Composition)
{
this.content[i].Resize(oMeasure, this, this.ParaMath, RPI, ArgSize);
this.content[i].ApplyGaps(); this.content[i].ApplyGaps();
} else if(this.content[i].Type == para_Math_Run)
else this.content[i].Math_ApplyGaps();
this.content[i].Math_Recalculate(oMeasure, this, this.ParaMath.Paragraph, RPI, ArgSize);
this.WidthToElement[i] = width; this.WidthToElement[i] = width;
...@@ -3901,17 +3861,28 @@ CMathContent.prototype = ...@@ -3901,17 +3861,28 @@ CMathContent.prototype =
for(var pos = 0; pos < lng; pos++) for(var pos = 0; pos < lng; pos++)
{ {
if(this.content[pos].Type == para_Math_Composition) if(this.content[pos].Type == para_Math_Composition)
{ {
// мержим ctrPrp до того, как добавим Gaps ! // мержим ctrPrp до того, как добавим Gaps !
this.content[pos].Set_CompiledCtrPrp(ParaMath); // без ParaMath не смержим ctrPrp
this.content[pos].SetGaps(this, ParaMath, GapsInfo); //this.content[pos].Set_CompiledCtrPrp(ParaMath); // без ParaMath не смержим ctrPrp
// обнуляем Gaps, чтобы при расчете ширины они не участвовалиу
this.content[pos].GapLeft = 0;
this.content[pos].GapRight = 0;
this.content[pos].Resize(oMeasure, this, ParaMath, RPI, this.Compiled_ArgSz);
this.content[pos].SetGaps(GapsInfo);
//this.content[pos].ApplyGaps();
} }
else if(this.content[pos].Type == para_Math_Run /*&& !this.content[pos].Is_Empty()*/) else if(this.content[pos].Type == para_Math_Run /*&& !this.content[pos].Is_Empty()*/)
this.content[pos].Math_SetGaps(this, ParaMath.Paragraph, GapsInfo); {
this.content[pos].Math_Recalculate(oMeasure, this, ParaMath.Paragraph, RPI, this.Compiled_ArgSz);
this.content[pos].Math_SetGaps(GapsInfo);
//this.content[pos].Math_ApplyGaps();
}
} }
if(GapsInfo.Current !== null) if(GapsInfo.Current !== null)
GapsInfo.Current.GapRight = 0; GapsInfo.Current.GapRight = 0;
...@@ -3995,7 +3966,6 @@ CMathContent.prototype = ...@@ -3995,7 +3966,6 @@ CMathContent.prototype =
this.content[i].Math_Draw(x, y, pGraphics); this.content[i].Math_Draw(x, y, pGraphics);
} }
} }
}, },
update_Cursor: function(CurPage, UpdateTarget) update_Cursor: function(CurPage, UpdateTarget)
{ {
...@@ -4115,38 +4085,6 @@ CMathContent.prototype = ...@@ -4115,38 +4085,6 @@ CMathContent.prototype =
}, },
//////////////////////// ////////////////////////
//////// /////////
/*getMetricsLetter: function(pos)
{
return this.content[pos+1].value.getMetrics();
},
// для диакритических элементов, если в контенте есть заглавные буквы, и для букв ascent > ascent "o"
// (!) повторяется функция (IsIncline)
IsHighElement: function()
{
var res = false;
for(var i =0 ; i < this.content.length; i++)
if(this.content[i].value.IsHighElement())
{
res = true;
break;
}
return res;
},*/
// (!) повторяется функция (IsHighElement)
/*IsIncline: function()
{
var bIncline = false;
if(this.content.length == 2)
bIncline = this.content[1].value.IsIncline();
return bIncline;
},*/
/// For Para Math /// For Para Math
Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget) Recalculate_CurPos : function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
......
...@@ -18,44 +18,6 @@ var DIV_CENT = 0.1386; ...@@ -18,44 +18,6 @@ var DIV_CENT = 0.1386;
var StartTextElement = 0x2B1A; // Cambria Math var StartTextElement = 0x2B1A; // Cambria Math
// TODO
// убрать CMathTextPrp
/*function CMathTextPrp()
{
this.FontFamily = undefined;
this.FontSize = undefined;
this.Bold = undefined;
this.Italic = undefined;
this.RFonts = {};
this.Lang = {};
}
CMathTextPrp.prototype =
{
Merge: function(prp)
{
if(prp.FontFamily !== undefined)
this.FontFamily = Common_CopyObj(prp.FontFamily);
if(prp.FontSize !== undefined)
this.FontSize = prp.FontSize;
if(prp.Bold !== undefined)
this.Bold = prp.Bold;
if(prp.Italic !== undefined)
this.Italic = prp.Italic;
},
Set: function(prp)
{
this.FontFamily = Common_CopyObj(prp.FontFamily);
this.FontSize = prp.FontSize;
this.Bold = prp.Bold;
this.Italic = prp.Italic;
}
}*/
// смена хентов // смена хентов
// editor.SetFontRenderingMode(2); // editor.SetFontRenderingMode(2);
...@@ -510,6 +472,9 @@ CMathText.prototype = ...@@ -510,6 +472,9 @@ CMathText.prototype =
height = g_oTextMeasurer.GetHeight(); height = g_oTextMeasurer.GetHeight();
*/ */
this.GapLeft = 0;
this.GapRight = 0;
if(!this.bJustDraw) if(!this.bJustDraw)
this.Parent = Run; this.Parent = Run;
else else
......
...@@ -91,7 +91,7 @@ CMathMatrix.prototype.setRuleGap = function(oSpace, rule, gap, minGap) ...@@ -91,7 +91,7 @@ CMathMatrix.prototype.setRuleGap = function(oSpace, rule, gap, minGap)
oSpace.gap = 0; oSpace.gap = 0;
if(minGap == minGap - 0 && minGap == minGap^0) if(minGap == minGap - 0 && minGap == minGap^0)
oSpace.minGap = gap; oSpace.minGap = minGap;
} }
CMathMatrix.prototype.recalculateSize = function(oMeasure) CMathMatrix.prototype.recalculateSize = function(oMeasure)
{ {
......
...@@ -141,7 +141,7 @@ CNary.prototype.fillContent = function(PropsInfo) ...@@ -141,7 +141,7 @@ CNary.prototype.fillContent = function(PropsInfo)
base.setLowerIterator(this.LowerIterator); base.setLowerIterator(this.LowerIterator);
base.setUpperIterator(this.UpperIterator); base.setUpperIterator(this.UpperIterator);
base.setCtrPrp(ctrPrp); base.setCtrPrp(ctrPrp);
base.Set_CompiledCtrPrp(this.ParaMath); //base.Set_CompiledCtrPrp(this.ParaMath);
} }
} }
...@@ -197,6 +197,11 @@ CNary.prototype.old_fillMathComposition = function(props, contents /*array*/) ...@@ -197,6 +197,11 @@ CNary.prototype.old_fillMathComposition = function(props, contents /*array*/)
} }
CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{ {
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps || RPI.bChangeInline == true) if(this.RecalcInfo.bProps || RPI.bChangeInline == true)
{ {
var oSign = this.getSign(this.Pr.chr, this.Pr.chrType); var oSign = this.getSign(this.Pr.chr, this.Pr.chrType);
...@@ -211,7 +216,7 @@ CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -211,7 +216,7 @@ CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Sign.add(oSign.chrCode); this.Sign.add(oSign.chrCode);
} }
if(this.Pr.limLoc == null || typeof(this.Pr.limLoc) == "undefined") if(limLoc == null || typeof(limLoc) == "undefined")
{ {
var bIntegral = oSign.chrCode > 0x222A && oSign.chrCode < 0x2231; var bIntegral = oSign.chrCode > 0x222A && oSign.chrCode < 0x2231;
...@@ -233,6 +238,8 @@ CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -233,6 +238,8 @@ CNary.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Pr.chrType = oSign.chrType; this.Pr.chrType = oSign.chrType;
this.fillContent(PropsInfo); this.fillContent(PropsInfo);
this.RecalcInfo.bProps = false;
} }
var NewRPI = RPI.Copy(); var NewRPI = RPI.Copy();
...@@ -739,14 +746,6 @@ CNaryUndOvr.prototype.setPosition = function(pos) ...@@ -739,14 +746,6 @@ CNaryUndOvr.prototype.setPosition = function(pos)
PosLowIter.x = pos.x + this.GapLeft + this.align(2,0).x; 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 + this.elements[1][0].size.height + this.gapBottom;
/*var x1 = pos.x + this.GapLeft + this.align(0, 0).x,
y1 = pos.y,
x2 = pos.x + this.GapLeft + this.align(1,0).x,
y2 = y1 + this.elements[0][0].size.height + this.gapTop,
x3 = pos.x + this.GapLeft + this.align(2,0).x,
y3 = y2 + this.elements[1][0].size.height + this.gapBottom;*/
this.elements[0][0].setPosition(PosUpIter); this.elements[0][0].setPosition(PosUpIter);
this.elements[1][0].setPosition(PosSign); this.elements[1][0].setPosition(PosSign);
this.elements[2][0].setPosition(PosLowIter); this.elements[2][0].setPosition(PosLowIter);
...@@ -876,10 +875,10 @@ CNaryOperator.prototype.Get_CompiledCtrPrp = function() ...@@ -876,10 +875,10 @@ CNaryOperator.prototype.Get_CompiledCtrPrp = function()
{ {
return this.Parent.Get_CompiledCtrPrp(); return this.Parent.Get_CompiledCtrPrp();
} }
CNaryOperator.prototype.IsOnlyText = function() /*CNaryOperator.prototype.IsOnlyText = function()
{ {
return false; return false;
} }*/
function CSigma() function CSigma()
{ {
......
...@@ -3468,6 +3468,8 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3468,6 +3468,8 @@ CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps == true) if(this.RecalcInfo.bProps == true)
{ {
var begPrp = var begPrp =
...@@ -3928,12 +3930,6 @@ CCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -3928,12 +3930,6 @@ CCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
/*if(this.RecalcInfo.bCtrPrp == true)
{
this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false;
}*/
var base = this.elements[0][0]; var base = this.elements[0][0];
base.Resize(oMeasure, this, ParaMath, RPI, ArgSize); base.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
...@@ -3954,8 +3950,10 @@ CCharacter.prototype.setPosition = function(pos) ...@@ -3954,8 +3950,10 @@ CCharacter.prototype.setPosition = function(pos)
this.pos.x = pos.x; this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent; this.pos.y = pos.y - this.size.ascent;
var alignOp = (this.size.width - this.operator.size.width)/2, var width = this.size.width - this.GapLeft - this.GapRight;
alignCnt = (this.size.width - this.elements[0][0].size.width)/2;
var alignOp = (width - this.operator.size.width)/2,
alignCnt = (width - this.elements[0][0].size.width)/2;
var PosOper = new CMathPosition(), var PosOper = new CMathPosition(),
PosBase = new CMathPosition(); PosBase = new CMathPosition();
...@@ -4099,7 +4097,14 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg ...@@ -4099,7 +4097,14 @@ CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, Arg
this.RecalcInfo.bProps = false; this.RecalcInfo.bProps = false;
} }
CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize); var ArgSz = ArgSize.Copy();
if(this.Pr.pos == this.Pr.vertJc)
ArgSz.decrease();
this.Set_CompiledCtrPrp(ParaMath);
CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSz);
} }
CGroupCharacter.prototype.setProperties = function(props) CGroupCharacter.prototype.setProperties = function(props)
{ {
......
...@@ -998,12 +998,6 @@ CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -998,12 +998,6 @@ CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.Parent = Parent; this.Parent = Parent;
this.ParaMath = ParaMath; this.ParaMath = ParaMath;
/*if(this.RecalcInfo.bCtrPrp == true)
{
this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false;
}*/
if(this.RecalcInfo.bProps) if(this.RecalcInfo.bProps)
{ {
if(this.Pr.degHide == true) if(this.Pr.degHide == true)
...@@ -1039,8 +1033,12 @@ CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize) ...@@ -1039,8 +1033,12 @@ CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.RealBase = this.Base; this.RealBase = this.Base;
} }
this.RecalcInfo.bProps = false;
} }
this.Set_CompiledCtrPrp(ParaMath);
if(this.Pr.type == SQUARE_RADICAL) if(this.Pr.type == SQUARE_RADICAL)
this.RealBase.Resize(oMeasure, this, ParaMath, RPI, ArgSize); this.RealBase.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
else else
......
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