Commit dcc82cab authored by Anna.Pavlova's avatar Anna.Pavlova

1. Реализовала функцию для мержа текстовых настроек для управляющих элементов...

1. Реализовала функцию для мержа текстовых настроек для управляющих элементов объектов (текстовые свойства для управляющих элементов зависят от тестовых настроек первого Run)
2. На Resize сначала компилируем ArgSize каждого контента, TxtPrp для управляющих элементов и CtrPrp, вычисляем Gaps, затем делаем Recalculate
3. Поправила баг : при запросе Get_CompiledTextPr менялись скомпилированные настройки у пустого рана (из-за этого было падение при смене размера шрифта из меню)
4. Поправила свойство Delimiters при чтении файла
5. При добавлении сложных объектов (n-арных объектов, дробей и др) в итераторы N-арных операторов, итераторы степеней
6. Поправила баг : когда ctrPrp у степени больше TxtPrp итераторов, итераторы разъезжались у DegreeSupSub (беру смерженные ctrPrp для плейсхолдеров)
7. На Split матрицы копирую св-во Jc


git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58950 954022d7-b5bf-4e40-9824-e11837661b57
parent 635d70c9
......@@ -58,7 +58,7 @@ function ParaMath()
this.DefaultTextPr = new CTextPr();
this.DefaultTextPr.Italic = true;
this.DefaultTextPr.FontSize = 11;
this.DefaultTextPr.FontFamily = {Name : "Cambria Math", Index : -1 };
this.DefaultTextPr.RFonts.Set_All("Cambria Math", -1);
......@@ -150,13 +150,13 @@ ParaMath.prototype.Get_CompiledTextPr = function(Copy)
{
// TODO: ParaMath.Get_CompiledTextPr
var TextPr = new CTextPr();
//var TextPr = new CTextPr();
var oContent = this.GetSelectContent();
var mTextPr = oContent.Content.Get_CompiledTextPr(Copy);
TextPr.Merge( mTextPr );
//TextPr.Merge( mTextPr );
return TextPr;
return mTextPr;
};
ParaMath.prototype.Add = function(Item)
......@@ -379,11 +379,23 @@ ParaMath.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
else
{
var content = this.GetSelectContent().Content;
var FontSize = TextPr.FontSize;
if(TextPr.FontSize !== undefined && content.IsNormalTextInRuns() == false)
{
var NewTextPr = new CTextPr();
NewTextPr.FontSize = FontSize;
this.Root.Apply_TextPr(NewTextPr, IncFontSize, true);
TextPr.FontSize = undefined;
}
content.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
}
TextPr.FontSize = FontSize;
}
};
ParaMath.prototype.Clear_TextPr = function()
{
......@@ -522,7 +534,8 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
if(RPI.NeedResize)
{
this.Root.Resize(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize);
this.Root.PreRecalc(null, this, ArgSize, RPI);
this.Root.Resize(g_oTextMeasurer, RPI/*recalculate properties info*/);
// когда формула будеат разбиваться на строки, Position придется перерасчитывать
var pos = new CMathPosition();
pos.x = 0;
......@@ -900,7 +913,11 @@ ParaMath.prototype.SetInline = function(value)
ParaMath.prototype.SetNeedResize = function()
{
this.NeedResize = true;
}
};
ParaMath.prototype.NeedCompiledCtrPr = function()
{
this.Root.NeedCompiledCtrPr();
};
ParaMath.prototype.MathToImageConverter= function()
{
window.IsShapeToImageConverter = true;
......@@ -1497,6 +1514,7 @@ ParaMath.prototype.Split = function (ContentPos, Depth)
if(this.Root.content[Pos].Type == para_Math_Run)
{
NewParaMath = new ParaMath();
NewParaMath.Jc = this.Jc;
var NewRun = this.Root.content[Pos].Split(ContentPos, Depth+1);
NewParaMath.Root.Add_ToContent(0, NewRun);
......
......@@ -7793,7 +7793,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
for(var i=0; i < this.Content.length;i++)
this.Content[i].draw(X, Y, pGraphics);
}
ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI, ArgSize, WidthPoints)
ParaRun.prototype.Math_Recalculate = function(oMeasure, RPI, WidthPoints)
{
// пересчет элементов контента в Run
// Recalculate_MeasureContent
......@@ -7809,8 +7809,8 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI,
var RangeEndPos = this.Content.length;
this.Paragraph = Paragraph;
this.Parent = Parent;
//this.Paragraph = Paragraph;
//this.Parent = Parent;
// обновляем позиции start и end для Range
//this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos);
......@@ -7857,7 +7857,7 @@ ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI,
for (var i = 0 ; i < Lng; i++)
{
this.Content[i].Resize(oMeasure, this, RPI);
this.Content[i].Resize(oMeasure, RPI);
var oSize = this.Content[i].size;
......@@ -7951,6 +7951,21 @@ ParaRun.prototype.Math_SetGaps = function(GapsInfo)
}
}
}
ParaRun.prototype.Math_PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.Paragraph = ParaMath.Paragraph;
var FontSize = this.Get_CompiledPr(false).FontSize;
for (var Pos = 0 ; Pos < this.Content.length; Pos++ )
{
if( !this.Content[Pos].IsAlignPoint() )
GapsInfo.setGaps(this.Content[Pos], FontSize);
this.Content[Pos].PreRecalc(this);
}
}
ParaRun.prototype.IsPlaceholder = function()
{
return this.Content.length == 1 && this.Content[0].IsPlaceholder();
......@@ -8004,6 +8019,10 @@ ParaRun.prototype.Math_GetInfoLetter = function(Info)
else
Info.Result = false;
}
ParaRun.IsNormalText = function()
{
return this.MathPrp.nor === true;
}
function CParaRunStartState(Run)
{
......
......@@ -22,7 +22,7 @@ function CAccentCircumflex()
Asc.extendClass(CAccentCircumflex, CGlyphOperator);
CAccentCircumflex.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var alpha = this.Parent.GetTPrpToControlLetter().FontSize/36;
var width = 3.88*alpha;
var height = 3.175*alpha;
......@@ -40,7 +40,7 @@ CAccentCircumflex.prototype.calcSize = function(stretch)
}
CAccentCircumflex.prototype.calcCoord = function(stretch)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
//var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4;
......@@ -126,7 +126,7 @@ function CAccentLine()
Asc.extendClass(CAccentLine, CGlyphOperator);
CAccentLine.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var alpha = this.Parent.GetTPrpToControlLetter().FontSize/36;
var height = 1.68*alpha;
var width = 4.938*alpha;
......@@ -135,37 +135,9 @@ CAccentLine.prototype.calcSize = function(stretch)
return {width: width, height: height};
}
CAccentLine.prototype.old_calcCoord = function(stretch)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var X = [],
Y = [];
//stretch *= 0.9;
X[0] = 0; Y[0] = 0;
X[1] = stretch; Y[1] = 0;
X[2] = stretch; Y[2] = 0.011*fontSize;
X[3] = 0; Y[3] = Y[2];
X[4] = 0; Y[4] = 0;
var W = X[2],
H = Y[2];
return {XX: X, YY: Y, W: W, H: H};
}
CAccentLine.prototype.old_drawPath = function(pGraphics, XX, YY)
{
pGraphics._m(XX[0], YY[0]);
pGraphics._l(XX[1], YY[1]);
pGraphics._l(XX[2], YY[2]);
pGraphics._l(XX[3], YY[3]);
pGraphics._l(XX[4], YY[4]);
}
CAccentLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
var penW = fontSize*0.067 * 25.4/96;
var x1 = x + 25.4/96,
......@@ -184,7 +156,7 @@ function CAccentDoubleLine()
Asc.extendClass(CAccentDoubleLine, CGlyphOperator);
CAccentDoubleLine.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var alpha = this.Parent.GetTPrpToControlLetter().FontSize/36;
var height = 2.843*alpha;
var width = 4.938*alpha;
......@@ -205,7 +177,7 @@ CAccentDoubleLine.prototype.calcSize = function(stretch)
}
CAccentDoubleLine.prototype.old_calcCoord = function(stretch)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
var X = [],
Y = [];
......@@ -246,7 +218,7 @@ CAccentDoubleLine.prototype.old_drawPath = function(pGraphics, XX, YY)
}
CAccentDoubleLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
var diff = this.diff;
......@@ -273,7 +245,7 @@ function CAccentTilde()
Asc.extendClass(CAccentTilde, CGlyphOperator);
CAccentTilde.prototype.calcSize = function(stretch)
{
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var betta = this.Parent.GetTPrpToControlLetter().FontSize/36;
var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999
var height = 2.469444444444444*betta;
......@@ -326,7 +298,7 @@ CAccentTilde.prototype.calcCoord = function(stretch)
var XX = [],
YY = [];
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
......@@ -373,7 +345,7 @@ function CAccentBreve()
Asc.extendClass(CAccentBreve, CGlyphOperator);
CAccentBreve.prototype.calcSize = function(stretch)
{
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var betta = this.Parent.GetTPrpToControlLetter().FontSize/36;
var width = 4.2333333333333325*betta;
var height = 2.469444444444445*betta;
......@@ -413,7 +385,7 @@ CAccentBreve.prototype.calcCoord = function(stretch)
var XX = [],
YY = [];
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var fontSize = this.Parent.GetTPrpToControlLetter().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
......@@ -567,13 +539,8 @@ CAccent.prototype.setPosition = function(pos, PosInfo)
this.elements[0][0].setPosition(PosBase, PosInfo);
}
CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CAccent.prototype.ApplyProperties = function(RPI)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(ParaMath);
if(this.RecalcInfo.bProps == true)
{
var prp =
......@@ -583,25 +550,26 @@ CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
loc: LOCATION_TOP
};
var defaultPrp =
{
type: ACCENT_CIRCUMFLEX
};
var defaultPrp = {type: ACCENT_CIRCUMFLEX };
this.operator.mergeProperties(prp, defaultPrp);
this.RecalcInfo.bProps = false;
}
}
CAccent.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.ApplyProperties(RPI);
this.operator.PreRecalc(this, ParaMath);
this.operator.relate(this);
var base = this.elements[0][0];
base.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ctrPrp = this.Get_CompiledCtrPrp();
oMeasure.SetFont(ctrPrp);
CAccent.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, RPI, GapsInfo);
}
CAccent.prototype.Resize = function(oMeasure, RPI)
{
var base = this.getBase();
base.Resize(oMeasure, RPI);
this.operator.fixSize(ParaMath, oMeasure, base.size.width);
this.operator.fixSize(oMeasure, base.size.width);
var width = base.size.width, // (!)
height = base.size.height + this.operator.size.height,
......
......@@ -13,6 +13,7 @@ function CMathBase(bInside)
this.CtrPrp = new CTextPr();
this.CompiledCtrPrp = new CTextPr();
this.TextPrControlLetter = new CTextPr();
this.ArgSize = new CMathArgSize();
......@@ -97,7 +98,6 @@ CMathBase.prototype =
if(txtPrp !== null && typeof(txtPrp) !== "undefined")
{
this.CtrPrp.Merge(txtPrp);
this.CtrPrp.FontFamily = {Name : "Cambria Math", Index : -1 };
}
},
Get_CtrPrp: function()
......@@ -110,6 +110,16 @@ CMathBase.prototype =
return CtrPrp;
},
NeedCompiledCtrPr: function()
{
this.RecalcInfo.bCtrPrp = true;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].NeedCompiledCtrPr();
},
/*Set_CompiledCtrPrp: function(ParaMath)
{
var defaultRPrp = ParaMath.GetFirstRPrp();
......@@ -125,7 +135,7 @@ CMathBase.prototype =
},*/
Get_CompiledCtrPrp: function()
{
this.Set_CompiledCtrPrp(this.ParaMath);
this.Set_CompiledCtrPrp(this.Parent, this.ParaMath);
var CompiledCtrPrp;
......@@ -145,7 +155,7 @@ CMathBase.prototype =
},
Get_CompiledCtrPrp_2: function() // without arg Size
{
this.Set_CompiledCtrPrp(this.ParaMath);
this.Set_CompiledCtrPrp(this.Parent, this.ParaMath);
var CompiledCtrPrp;
......@@ -172,12 +182,11 @@ CMathBase.prototype =
},
// для управляющих символов в приоритете GetFirstRunPrp
// если первый элемент - мат объект, то берутся его CtrPrp
getPrpToControlLetter: function()
GetTPrpToControlLetter: function()
{
var rPrp = new CTextPr();
rPrp.Merge( this.ParaMath.GetFirstRPrp() );
this.Set_CompiledCtrPrp(this.Parent, this.ParaMath);
return rPrp;
return this.TextPrControlLetter;
},
fillPlaceholders: function()
{
......@@ -344,6 +353,26 @@ CMathBase.prototype =
{
return this.Parent.remove(order);
},
ApplyProperties: function(RPI)
{},
PreRecalc: function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(Parent, ParaMath);
this.ApplyProperties(RPI);
// setGaps обязательно после того как смержили CtrPrp (Set_CompiledCtrPrp)
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].PreRecalc(this, ParaMath, ArgSize, RPI);
},
recalculateSize: function(oMeasure, RPI)
{
var width = 0;
......@@ -366,20 +395,16 @@ CMathBase.prototype =
width += this.dW*(this.nCol - 1) + this.GapLeft + this.GapRight;
var ascent = this.getAscent(oMeasure, height, RPI);
var ascent = this.getAscent(oMeasure, height);
this.size = {width: width, height: height, ascent: ascent};
},
Resize: function(oMeasure, Parent, ParaMath, RPI, ArgSize)
Resize: function(oMeasure, RPI)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.elements[i][j].Resize(oMeasure, RPI);
this.recalculateSize(oMeasure, RPI);
},
......@@ -390,7 +415,58 @@ CMathBase.prototype =
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].Resize_2(oMeasure, this, ParaMath, RPI, ArgSize);
},
Set_CompiledCtrPrp: function(ParaMath)
Set_CompiledCtrPrp: function(Parent, ParaMath)
{
if(this.RecalcInfo.bCtrPrp == true)
{
// for Ctr Prp
//this.CompiledCtrPrp = ParaMath.GetFirstRPrp();
var defaultTxtPrp = ParaMath.Get_Default_TPrp();
this.CompiledCtrPrp.FontFamily =
{
Name: defaultTxtPrp.FontFamily.Name,
Index: defaultTxtPrp.FontFamily.Index
};
this.CompiledCtrPrp.FontSize = defaultTxtPrp.FontSize;
this.CompiledCtrPrp.Merge(this.CtrPrp);
// for Control Letter
var FontSize = ParaMath.GetFirstRPrp().FontSize;
if(this.bInside == true)
{
var TxtPr = Parent.Get_TxtPrControlLetter();
FontSize = TxtPr.FontSize;
FontSize = ParaMath.ApplyArgSize(FontSize, this.ArgSize.value);
}
else
{
FontSize = ParaMath.ApplyArgSize(FontSize, Parent.Get_CompiledArgSize().value);
FontSize = ParaMath.ApplyArgSize(FontSize, this.ArgSize.value);
}
this.TextPrControlLetter.FontSize = FontSize;
this.TextPrControlLetter.FontFamily =
{
Name: defaultTxtPrp.FontFamily.Name,
Index: defaultTxtPrp.FontFamily.Index
};
this.RecalcInfo.bCtrPrp = false;
}
},
Get_TxtPrControlLetter: function() // TextPrControlLetter не копируются !
{
this.Set_CompiledCtrPrp(this.Parent, this.ParaMath);
return this.TextPrControlLetter;
},
old_Set_CompiledCtrPrp: function(ParaMath)
{
if(this.RecalcInfo.bCtrPrp == true)
{
......@@ -488,8 +564,8 @@ CMathBase.prototype =
},
SetGaps: function(GapsInfo)
{
this.Parent = GapsInfo.Parent;
this.ParaMath = GapsInfo.ParaMath;
//this.Parent = GapsInfo.Parent;
//this.ParaMath = GapsInfo.ParaMath;
GapsInfo.Left = GapsInfo.Current;
......@@ -566,6 +642,9 @@ CMathBase.prototype =
},
Apply_TextPr: function(TextPr, IncFontSize, ApplyToAll)
{
if(ApplyToAll == true)
this.RecalcInfo.bCtrPrp = true;
if(TextPr == undefined)
{
var CtrPrp = this.Get_CompiledCtrPrp_2();
......
"use strict";
function CMathBreak()
{
this.AlnAt = undefined;
}
CMathBreak.prototype.Set_FromObj = function(Obj)
{
if(Obj.AlnAt !== undefined && Obj.AlnAt !== null && Obj.AlnAt - 0 == 0)
{
if(Obj.AlnAt >= 0 && Obj.AlnAt <= 255)
this.AlnAt = Obj.AlnAt;
}
}
function CMathBorderBoxPr()
{
this.hideBot = false;
......@@ -139,7 +152,7 @@ CBorderBox.prototype.recalculateSize = function()
var height = base.height;
var ascent = base.ascent;
this.gapBrd = this.Get_CompiledCtrPrp().FontSize*0.08104587131076388;
this.gapBrd = this.GetTPrpToControlLetter().FontSize*0.08104587131076388;
if(this.Pr.hideTop == false)
{
......@@ -162,7 +175,7 @@ CBorderBox.prototype.draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(x, y, pGraphics);
var penW = this.Get_CompiledCtrPrp().FontSize*0.02;
var penW = this.GetTPrpToControlLetter().FontSize*0.02;
var Width = this.size.width - this.GapLeft - this.GapRight,
Height = this.size.height;
......@@ -523,28 +536,24 @@ CBar.prototype.fillContent = function()
this.setDimension(1, 1);
this.elements[0][0] = this.getBase();
}
CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CBar.prototype.ApplyProperties = function(RPI)
{
if(this.RecalcInfo.bProps == true)
{
var prp =
{
loc: this.Pr.pos,
type: DELIMITER_LINE
};
var prp = {loc: this.Pr.pos, type: DELIMITER_LINE };
var defaultProps =
{
loc: LOCATION_BOT
};
var defaultProps = { loc: LOCATION_BOT};
this.setCharacter(prp, defaultProps);
this.RecalcInfo.bProps = false;
}
}
CBar.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.ApplyProperties(RPI);
this.operator.PreRecalc(this, ParaMath);
//this.Set_CompiledCtrPrp(ParaMath);
CBar.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
CBar.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, RPI, GapsInfo);
}
CBar.prototype.getAscent = function()
{
......
......@@ -46,6 +46,7 @@ function CDegreeBase(props, bInside)
if(props !== null && typeof(props) !== "undefined")
this.init(props);
//CDegreeBase.prototype.init.call(this, props);
}
Asc.extendClass(CDegreeBase, CMathBase);
CDegreeBase.prototype.init = function(props)
......@@ -59,19 +60,41 @@ CDegreeBase.prototype.fillContent = function()
this.elements[0][0] = this.baseContent;
this.elements[0][1] = this.iterContent;
};
CDegreeBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CDegreeBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
this.Set_CompiledCtrPrp(Parent, ParaMath);
this.ApplyProperties(RPI);
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.baseContent.PreRecalc(this, ParaMath, ArgSize, RPI);
var ArgSzDegr = ArgSize.Copy();
ArgSzDegr.decrease();
this.elements[0][1].Resize(oMeasure, this, ParaMath, RPI, ArgSzDegr);
var RPIDegr = RPI.Copy();
RPIDegr.bDecreasedComp = true;
this.iterContent.PreRecalc(this, ParaMath, ArgSzDegr, RPIDegr);
}
CDegreeBase.prototype.Resize = function(oMeasure, RPI)
{
//this.Parent = Parent;
//this.ParaMath = ParaMath;
//this.Set_CompiledCtrPrp(ParaMath);
this.baseContent.Resize(oMeasure, RPI);
//var ArgSzDegr = ArgSize.Copy();
//ArgSzDegr.decrease();
this.iterContent.Resize(oMeasure, RPI);
if(this.Pr.type === DEGREE_SUPERSCRIPT)
this.recalculateSup(oMeasure);
......@@ -83,24 +106,20 @@ CDegreeBase.prototype.recalculateSup = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
this.upBase = 0;
this.upIter = 0;
var oBase = this.elements[0][0];
//var bBaseOnlyText = oBase.IsJustDraw() ? false : oBase.IsOnlyText(); // у Just-Draw элементов нет ф-ии IsOnlyText
var bOneLineText = oBase.IsJustDraw() ? false : oBase.IsOneLineText();
if(bOneLineText)
{
//var UpBaseline = 1.786*shCenter; // baseline итератора
var UpBaseline = 1.65*shCenter; // baseline итератора
// iter.height - UpBaseline - iter.ascent + base.ascent > 2/3 * base.height
if(iter.height - UpBaseline - iter.ascent + base.ascent > 2/3 * base.ascent)
this.upBase = iter.height - 2/3*base.ascent;
else if(UpBaseline + iter.ascent > base.ascent)
......@@ -138,15 +157,13 @@ CDegreeBase.prototype.recalculateSubScript = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
var width = base.width + iter.width + this.dW;
width += this.GapLeft + this.GapRight;
var oBase = this.elements[0][0];
//var bBaseOnlyText = oBase.IsJustDraw() ? false : oBase.IsOnlyText(); // у Just-Draw элементов нет ф-ии IsOnlyText
var bOneLineText = oBase.IsJustDraw() ? false : oBase.IsOneLineText();
if(bOneLineText)
......@@ -278,6 +295,24 @@ CIterators.prototype.init = function()
this.elements[0][0] = this.iterUp;
this.elements[1][0] = this.iterDn;
};
CIterators.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.ArgSize.SetValue(-1);
var ArgSzIters = ArgSize.Copy();
ArgSzIters.Merge(this.ArgSize);
this.Set_CompiledCtrPrp(Parent, ParaMath);
var RPI_ITER = RPI.Copy();
RPI_ITER.bDecreasedComp = true;
this.iterUp.PreRecalc(this, ParaMath, ArgSzIters, RPI_ITER);
this.iterDn.PreRecalc(this, ParaMath, ArgSzIters, RPI_ITER);
};
CIterators.prototype.getUpperIterator = function()
{
return this.elements[0][0];
......@@ -294,10 +329,6 @@ CIterators.prototype.setLowerIterator = function(iterator)
{
this.elements[1][0] = iterator;
};
CIterators.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
};
CIterators.prototype.alignIterators = function(mcJc)
{
this.alignment.wdt[0] = mcJc;
......@@ -354,6 +385,7 @@ function CDegreeSubSupBase(props, bInside)
CDegreeSubSupBase.superclass.constructor.call(this, bInside);
this.gapBase = 0;
this.bNaryInline = false;
this.Pr = new CMathDegreeSubSupPr();
......@@ -392,7 +424,29 @@ CDegreeSubSupBase.prototype.fillContent = function()
oIters.alignIterators(MCJC_RIGHT);
}
};
CDegreeSubSupBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CDegreeSubSupBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.bNaryInline = RPI.bNaryInline;
CDegreeSubSupBase.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, RPI, GapsInfo);
};
/*CDegreeSubSupBase.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(Parent, ParaMath);
var ArgSzIters = ArgSize.Copy();
ArgSzIters.decrease();
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
this.baseContent.PreRecalc(this, ParaMath, ArgSize, RPI);
this.iters.PreRecalc(this, ParaMath, ArgSzIters, RPI);
};*/
/*CDegreeSubSupBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
......@@ -406,10 +460,14 @@ CDegreeSubSupBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, A
this.iters.Resize(oMeasure, this, ParaMath, RPI, ArgSzIters);
this.recalculateSize(oMeasure, RPI);
};
};*/
CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure, RPI)
{
var mgCtrPrp = this.Get_CompiledCtrPrp();
//var mgCtrPrp = this.GetTPrpToControlLetter();
var mgCtrPrp = this.Get_CompiledCtrPrp(); // Get_CompiledCtrPrp - чтобы итераторы не разъезжались
// половину ascent брать нельзя, т.к. черта дроби будет разделительной для верхнего и нижнего итератора => соответственно
// если числитель меньше/больше знаменателя расположение итераторов у степени будет неправильным
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
shCenter *= 1.4;
......@@ -433,16 +491,17 @@ CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure, RPI)
iterDown = iters.elements[1][0].size;
var lUp = base.size.ascent - shCenter; // center of base
//var lUp = base.size.height/2; // center of base
var lDown = base.size.height - lUp; // height - center of base
var ctrPrpIter = iters.Get_CompiledCtrPrp();
var ctrPrpIter = iters.GetTPrpToControlLetter();
var shIter = this.ParaMath.GetShiftCenter(oMeasure, ctrPrpIter); //смещение
var minGap = 0.7*shIter;
var up, down;
if(RPI.bNaryInline == true)
if(this.bNaryInline)
{
up = down = 0;
}
......@@ -467,7 +526,6 @@ CDegreeSubSupBase.prototype.recalculateSize = function(oMeasure, RPI)
}
if(up + down > minGap)
{
this.gapBase = iterUp.height + up - lUp;
......
......@@ -75,9 +75,7 @@ CFraction.prototype.draw = function(x, y, pGraphics)
}
CFraction.prototype.drawBarFraction = function(x, y, pGraphics)
{
//var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp_2();
mgCtrPrp.FontSize = this.ParaMath.ApplyArgSize(mgCtrPrp.FontSize, this.Parent.Get_CompiledArgSize().value);
var mgCtrPrp = this.GetTPrpToControlLetter();
var penW = mgCtrPrp.FontSize* 25.4/96 * 0.08;
......@@ -102,8 +100,7 @@ CFraction.prototype.drawBarFraction = function(x, y, pGraphics)
}
CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics)
{
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var penW = mgCtrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
......@@ -208,8 +205,7 @@ CFraction.prototype.drawLinearFraction = function(x, y, pGraphics)
x2 = X + this.elements[0][0].size.width + shift,
y2 = Y + this.size.height;
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var penW = mgCtrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
pGraphics.SetFont(mgCtrPrp);
......@@ -247,7 +243,45 @@ CFraction.prototype.getDenominator = function()
return denominator;
}
CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CFraction.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
var ArgSzNumDen = ArgSize.Copy();
if(RPI.bInline == true && (this.Pr.type === BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)) // уменьшае размер числителя и знаменателя
{
ArgSzNumDen.decrease(); // для контентов числителя и знаменателя
this.ArgSize.SetValue(-1); // для CtrPrp
}
else if(RPI.bDecreasedComp == true) // уменьшаем расстояние между числителем и знаменателем (размер FontSize для TxtPr ControlLetter)
// this.ArgSize отвечает за TxtPr ControlLetter
{
this.ArgSize.SetValue(-1); // для CtrPrp
}
else
{
this.ArgSize.SetValue(0);
}
this.Set_CompiledCtrPrp(Parent, ParaMath);
this.ApplyProperties(RPI);
var NewRPI = RPI.Copy();
if(this.Pr.type !== LINEAR_FRACTION)
NewRPI.bDecreasedComp = true;
// setGaps обязательно после того как смержили CtrPrp (Set_CompiledCtrPrp)
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
this.Numerator.PreRecalc(this, ParaMath, ArgSzNumDen, NewRPI);
this.Denominator.PreRecalc(this, ParaMath, ArgSzNumDen, NewRPI);
}
/*CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
var ArgSzFr = ArgSize.Copy();
......@@ -265,6 +299,8 @@ CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.ArgSize.SetValue(0);
}
// ??!!
if(this.Pr.type == NO_BAR_FRACTION)
{
ArgSzFr.decrease();
......@@ -279,10 +315,11 @@ CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
//this.Set_CompiledCtrPrp(ParaMath);
var NewRPI = RPI.Copy();
NewRPI.bInsideFraction = true;
if(this.Pr.type !== LINEAR_FRACTION)
NewRPI.bInsideFraction = true;
CFraction.superclass.Resize.call(this, oMeasure, Parent, ParaMath, NewRPI, ArgSzFr);
}
}*/
CFraction.prototype.recalculateSize = function(oMeasure)
{
if(this.Pr.type == BAR_FRACTION || this.Pr.type == NO_BAR_FRACTION)
......@@ -297,8 +334,7 @@ CFraction.prototype.recalculateBarFraction = function(oMeasure)
var num = this.elements[0][0].size,
den = this.elements[1][0].size;
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var width = num.width > den.width ? num.width : den.width;
var height = num.height + den.height;
......@@ -310,8 +346,7 @@ CFraction.prototype.recalculateBarFraction = function(oMeasure)
}
CFraction.prototype.recalculateSkewed = function(oMeasure)
{
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
//this.gapSlash = 5.011235894097222 * mgCtrPrp.FontSize/36;
this.dW = 5.011235894097222 * mgCtrPrp.FontSize/36;
......@@ -331,8 +366,8 @@ CFraction.prototype.recalculateLinear = function()
DescentSecond = this.elements[0][1].size.height - this.elements[0][1].size.ascent;
var H = AscentFirst + DescentSecond;
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var gap = 5.011235894097222*mgCtrPrp.FontSize/36;
......@@ -428,7 +463,7 @@ CFractionBase.prototype.init = function(MathContent)
this.setDimension(1, 1);
this.elements[0][0] = MathContent;
}
CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
/*CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
......@@ -438,7 +473,7 @@ CFractionBase.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSi
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize();
}
}*/
CFractionBase.prototype.getElement = function()
{
return this.elements[0][0];
......@@ -465,7 +500,7 @@ CNumerator.prototype.recalculateSize = function()
{
var arg = this.elements[0][0].size;
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var Descent = arg.height - arg.ascent; // baseLine
......@@ -517,7 +552,7 @@ CDenominator.prototype.recalculateSize = function()
{
var arg = this.elements[0][0].size;
var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.GetTPrpToControlLetter();
var Ascent = arg.ascent - 4.938888888888888*mgCtrPrp.FontSize/36;
......
......@@ -30,6 +30,87 @@ CMathLimitPr.prototype.Read_FromBinary = function(Reader)
this.type = Reader.GetLong();
};
function CLimitPrimary(bInside, Type, FName, Iterator)
{
CLimitPrimary.superclass.constructor.call(this, bInside);
this.Type = Type;
this.FName = null;
this.Iterator = null;
this.init(FName, Iterator);
}
Asc.extendClass(CLimitPrimary, CMathBase);
CLimitPrimary.prototype.init = function(FName, Iterator)
{
this.setDimension(2, 1);
if(this.Type == LIMIT_LOW)
{
this.FName = FName;
this.Iterator = new CDenominator(Iterator);
this.elements[0][0] = this.FName;
this.elements[1][0] = this.Iterator;
}
else
{
this.Iterator = Iterator;
this.FName = FName;
this.elements[0][0] = this.Iterator;
this.elements[1][0] = this.FName;
}
}
CLimitPrimary.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(Parent, ParaMath);
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
this.FName.PreRecalc(this, ParaMath, ArgSize, RPI);
var ArgSzIter = ArgSize.Copy();
ArgSzIter.decrease();
var NewRPI = RPI.Copy();
NewRPI.bDecreasedComp = true;
this.Iterator.PreRecalc(this, ParaMath, ArgSzIter, NewRPI);
}
CLimitPrimary.prototype.Resize = function(oMeasure, RPI)
{
if(this.Type == LIMIT_LOW)
this.dH = 0;
else
this.dH = 0.06*this.GetTPrpToControlLetter().FontSize;
this.FName.Resize(oMeasure, RPI);
this.Iterator.Resize(oMeasure, RPI);
var SizeFName = this.FName.size,
SizeIter = this.Iterator.size;
var width = SizeFName.width > SizeIter.width ? SizeFName.width : SizeIter.width,
height = SizeFName.height + SizeIter.height,
ascent;
if(this.Type == LIMIT_LOW)
ascent = SizeFName.ascent;
else if(this.Type == LIMIT_UP)
ascent = SizeIter.height + this.dH + SizeFName.ascent;
width += this.GapLeft + this.GapRight;
this.size = {width: width, height: height, ascent: ascent};
}
function CLimit(props)
{
CLimit.superclass.constructor.call(this);
......@@ -67,121 +148,35 @@ CLimit.prototype.getIterator = function()
{
return this.Content[1];
}
CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CLimit.prototype.ApplyProperties = function(RPI)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
if(this.RecalcInfo.bProps == true || RPI.bChangeInline == true)
{
this.setDimension(1, 1);
if(RPI.bInline == true && RPI.bMathFunc == true)
{
this.setDimension(1, 1);
var props;
if(this.Pr.type == LIMIT_LOW)
{
props =
{
type: DEGREE_SUBSCRIPT,
ctrPrp: this.CtrPrp
};
}
props = {type: DEGREE_SUBSCRIPT, ctrPrp: this.CtrPrp};
else
{
props =
{
type: DEGREE_SUPERSCRIPT,
ctrPrp: this.CtrPrp
};
}
this.elements[0][0] = new CDegreeBase(null, true);
props = {type: DEGREE_SUPERSCRIPT, ctrPrp: this.CtrPrp};
this.elements[0][0] = new CDegreeBase(props, true);
this.elements[0][0].setBase(this.getFName());
this.elements[0][0].setIterator(this.getIterator());
this.elements[0][0].fillContent();
this.FName = this.getFName();
this.Iterator = this.getIterator();
}
else
{
this.setDimension(2, 1);
if(this.Pr.type == LIMIT_LOW)
{
this.dH = 0;
this.FName = this.getFName();
this.Iterator = new CDenominator(this.getIterator());
this.elements[0][0] = this.FName;
this.elements[1][0] = this.Iterator;
}
else
{
this.FName = this.getFName();
this.Iterator = this.getIterator();
this.dH = 0.06*this.Get_CompiledCtrPrp().FontSize;
this.elements[0][0] = this.Iterator;
this.elements[1][0] = this.FName;
}
this.elements[0][0] = new CLimitPrimary(true, this.Pr.type, this.getFName(), this.getIterator());
}
this.RecalcInfo.bProps = false;
}
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.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,
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;
this.size = {width: width, height: height, ascent: ascent};
}
}
function CMathFunc(props)
{
CMathFunc.superclass.constructor.call(this);
......@@ -207,18 +202,16 @@ CMathFunc.prototype.init = function(props)
this.setProperties(props);
this.fillContent();
}
CMathFunc.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CMathFunc.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
RPI.bMathFunc = true;
CMathFunc.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
RPI.bMathFunc = false;
var NewRPI = RPI.Copy();
NewRPI.bMathFunc = true;
CMathFunc.superclass.PreRecalc.call(this, Parent, ParaMath, ArgSize, NewRPI, GapsInfo);
}
CMathFunc.prototype.setDistance = function()
{
this.dW = this.Get_CompiledCtrPrp().FontSize/6*g_dKoef_pt_to_mm;
this.dW = this.GetTPrpToControlLetter().FontSize/6*g_dKoef_pt_to_mm;
}
CMathFunc.prototype.getFName = function()
{
......
This diff is collapsed.
......@@ -539,7 +539,7 @@ CMathText.prototype =
this.Type = para_Math_Placeholder;
this.value = StartTextElement;
},
Resize: function(oMeasure, Parent, RPI)
Resize: function(oMeasure, RPI)
{
/*
var metricsTxt = g_oTextMeasurer.Measure2Code(letter);
......@@ -547,10 +547,10 @@ CMathText.prototype =
height = g_oTextMeasurer.GetHeight();
*/
if(!this.bJDraw)
/*if(!this.bJDraw)
this.Parent = Parent;
else
this.Parent = null;
this.Parent = null;*/
var letter = this.getCode();
......@@ -601,6 +601,13 @@ CMathText.prototype =
//this.RecalcInfo.NewLetter = false;
},
PreRecalc: function(Parent, ParaMath, ArgSize, RPI)
{
if(!this.bJDraw)
this.Parent = Parent;
else
this.Parent = null;
},
Get_WidthVisible: function()
{
return this.size.width;
......@@ -786,7 +793,7 @@ function CMathAmp()
this.pos = new CMathPosition();
this.AmpText = new CMathText(false);
this.AmpText = new CMathText(true);
this.AmpText.add(0x26);
this.size = null;
......@@ -794,9 +801,8 @@ function CMathAmp()
}
CMathAmp.prototype =
{
Resize: function(oMeasure, Parent, RPI)
Resize: function(oMeasure, RPI)
{
this.Parent = Parent;
this.bEqqArray = RPI.bEqqArray;
this.AmpText.Resize(oMeasure, this, RPI);
......@@ -821,6 +827,13 @@ CMathAmp.prototype =
}
},
PreRecalc: function(Parent, ParaMath, ArgSize, RPI)
{
if(!this.bJDraw)
this.Parent = Parent;
else
this.Parent = null;
},
Get_WidthVisible: function()
{
return this.size.width;
......
......@@ -242,12 +242,12 @@ CMatrixBase.prototype.recalculateSize = function(oMeasure, RPI)
this.RecalcInfo.bProps = false;
}
var txtPrp = this.Get_CompiledCtrPrp();
var FontSize = this.GetTPrpToControlLetter().FontSize;
var metrics = this.getMetrics();
if(this.nCol > 1)
{
var gapsCol = this.getLineGap(this.spaceColumn, txtPrp);
var gapsCol = this.getLineGap(this.spaceColumn, FontSize);
for(var i = 0; i < this.nCol - 1; i++)
this.gaps.column[i] = gapsCol;
......@@ -257,12 +257,12 @@ CMatrixBase.prototype.recalculateSize = function(oMeasure, RPI)
if(this.nRow > 1)
{
var intervalRow = this.getRowSpace(this.spaceRow, txtPrp);
var intervalRow = this.getRowSpace(this.spaceRow, FontSize);
var divCenter = 0;
var plH = 0.2743827160493827 * txtPrp.FontSize;
var minGp = this.spaceRow.minGap*txtPrp.FontSize*g_dKoef_pt_to_mm;
var plH = 0.2743827160493827*FontSize;
var minGp = this.spaceRow.minGap*FontSize*g_dKoef_pt_to_mm;
minGp -= plH;
for(var j = 0; j < this.nRow - 1; j++)
......@@ -355,7 +355,7 @@ CMatrixBase.prototype.setRuleGap = function(oSpace, rule, gap, minGap)
if(minGap == minGap - 0 && minGap == minGap^0)
oSpace.minGap = minGap;
};
CMatrixBase.prototype.getLineGap = function(spaceColumn, txtPrp)
CMatrixBase.prototype.getLineGap = function(spaceColumn, FontSize)
{
var spLine;
......@@ -377,9 +377,9 @@ CMatrixBase.prototype.getLineGap = function(spaceColumn, txtPrp)
if(spaceColumn.rule == 3)
lineGap = spLine*g_dKoef_pt_to_mm; //pt
else
lineGap = spLine*txtPrp.FontSize*g_dKoef_pt_to_mm; //em
lineGap = spLine*FontSize*g_dKoef_pt_to_mm; //em
var wPlh = 0.3241834852430555 * txtPrp.FontSize;
var wPlh = 0.3241834852430555*FontSize;
var min = spaceColumn.minGap / 20 * g_dKoef_pt_to_mm - wPlh;
lineGap = Math.max(lineGap, min);
......@@ -387,7 +387,7 @@ CMatrixBase.prototype.getLineGap = function(spaceColumn, txtPrp)
return lineGap;
};
CMatrixBase.prototype.getRowSpace = function(spaceRow, txtPrp)
CMatrixBase.prototype.getRowSpace = function(spaceRow, FontSize)
{
var spLine;
......@@ -409,10 +409,10 @@ CMatrixBase.prototype.getRowSpace = function(spaceRow, txtPrp)
if(spaceRow.rule == 3)
lineGap = spLine*g_dKoef_pt_to_mm; //pt
else
lineGap = spLine*txtPrp.FontSize*g_dKoef_pt_to_mm; //em
lineGap = spLine*FontSize*g_dKoef_pt_to_mm; //em
var min = spaceRow.minGap*txtPrp.FontSize*g_dKoef_pt_to_mm;
var min = spaceRow.minGap*FontSize*g_dKoef_pt_to_mm;
lineGap = Math.max(lineGap, min);
return lineGap;
......@@ -688,30 +688,22 @@ CEqArray.prototype.fillContent = function()
for (var nIndex = 0; nIndex < nRowsCount; nIndex++)
this.elements[nIndex][0] = this.Content[nIndex];
};
CEqArray.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CEqArray.prototype.Resize = function(oMeasure, RPI)
{
// на случай, чтобы не затереть массив
//var CurrAmperWPoints = RPI.AmperWPoints,
// CurrEqqArray = RPI.bEqqArray;
RPI.bEqqArray = true;
var NewRPI = RPI.Copy();
NewRPI.bEqqArray = true;
this.Parent = Parent;
this.ParaMath = ParaMath;
for(var i = 0; i < this.nRow; i++)
{
this.elements[i][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.elements[i][0].Resize(oMeasure, NewRPI);
}
this.recalculateSize(oMeasure, RPI);
RPI.bEqqArray = false;
//RPI.AmperWPoints = CurrAmperWPoints;
//RPI.bEqqArray = CurrEqqArray;
//CEqArray.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
this.recalculateSize(oMeasure);
}
CEqArray.prototype.getMetrics = function()
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -439,11 +439,31 @@ CRadical.prototype.fillContent = function()
this.Iterator = this.getDegree();
this.Base = this.getBase();
};
CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
CRadical.prototype.PreRecalc = function(Parent, ParaMath, ArgSize, RPI, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.Set_CompiledCtrPrp(Parent, ParaMath);
this.ApplyProperties(RPI);
if(this.Pr.type == SQUARE_RADICAL)
this.RealBase.PreRecalc(this, ParaMath, ArgSize, RPI);
else
{
var ArgSzIter = new CMathArgSize();
ArgSzIter.SetValue(-2);
this.Iterator.PreRecalc(this, ParaMath, ArgSzIter, RPI);
this.RealBase.PreRecalc(this, ParaMath, ArgSize, RPI);
}
if(this.bInside == false)
GapsInfo.setGaps(this, this.TextPrControlLetter.FontSize);
}
CRadical.prototype.ApplyProperties = function(RPI)
{
if(this.RecalcInfo.bProps)
{
if(this.Pr.degHide == true)
......@@ -490,20 +510,16 @@ CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
this.RecalcInfo.bProps = false;
}
//this.Set_CompiledCtrPrp(ParaMath);
}
CRadical.prototype.Resize = function(oMeasure, RPI)
{
if(this.Pr.type == SQUARE_RADICAL)
this.RealBase.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.RealBase.Resize(oMeasure, RPI);
else
{
var ArgSzIter = new CMathArgSize();
ArgSzIter.SetValue(-2);
//ArgSzIter.Merge(ArgSize);
this.Iterator.Resize(oMeasure, this, ParaMath, RPI, ArgSzIter);
this.RealBase.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.Iterator.Resize(oMeasure, RPI);
this.RealBase.Resize(oMeasure, RPI);
}
var shTop,
......
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