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

Для совместного редактирования :

1. ссылка на родительский класс и ссылка на ParaMath прокидываются каждый раз на Resize
2. ctrPrp мержатся на Resize (при изменении ctrPrp)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56239 954022d7-b5bf-4e40-9824-e11837661b57
parent 7267c0f2
......@@ -13,7 +13,7 @@ function ParaMath(bAddMenu)
//this.Root = this.Math.Root;
this.Root = new CMathContent();
this.Root.setComposition(this);
//this.Root.setComposition(this);
this.X = 0;
this.Y = 0;
......@@ -35,6 +35,8 @@ function ParaMath(bAddMenu)
this.Range = this.Lines[0].Ranges[0];
this.NearPosArray = new Array();
this.Width = 0;
this.WidthVisible = 0;
this.Height = 0;
......@@ -352,7 +354,7 @@ ParaMath.prototype =
{
// TODO: ParaMath.Apply_TextPr
this.Root.Apply_TextPr();
this.Root.Apply_TextPr(TextPr, IncFontSize, ApplyToAll);
},
......@@ -363,6 +365,16 @@ ParaMath.prototype =
Check_NearestPos : function(ParaNearPos, Depth)
{
var MathNearPos = new CParagraphElementNearPos();
MathNearPos.NearPos = ParaNearPos.NearPos;
MathNearPos.Depth = Depth;
// CParagraphNearPos for ParaNearPos
this.NearPosArray.push( MathNearPos );
ParaNearPos.Classes.push( this );
var CurPos = ParaNearPos.NearPos.ContentPos.Get(Depth);
this.Content[CurPos].Check_NearestPos( ParaNearPos, Depth + 1 );
},
Get_DrawingObjectRun : function(Id)
......@@ -395,6 +407,9 @@ ParaMath.prototype =
Create_FontMap : function(Map)
{
// TODO: ParaMath.Create_FontMap
this.Root.Create_FontMap(Map);
},
Get_AllFontNames : function(AllFonts)
......@@ -429,7 +444,11 @@ ParaMath.prototype =
{
if ( true === DropCapText.Check )
DropCapText.Mixed = true;
},
},
Add_ToContent : function(Pos, Item, UpdatePosition)
{
},
//-----------------------------------------------------------------------------------
// Функции пересчета
//-----------------------------------------------------------------------------------
......@@ -464,7 +483,7 @@ ParaMath.prototype =
//this.Math.RecalculateComposition(g_oTextMeasurer, TextPr);
this.Root.Resize(g_oTextMeasurer, TextPr);
this.Root.Resize(null, this, g_oTextMeasurer, TextPr);
this.Root.setPosition({x: 0, y: 0});
this.Width = this.Root.size.width;
......@@ -1047,7 +1066,7 @@ ParaMath.prototype =
this.bSelectionUse = true;
this.Root.Set_Select_ToMComp(Direction);
console.log("bSelectionUse : " + this.bSelectionUse);
//console.log("bSelectionUse : " + this.bSelectionUse);
},
//-----------------------------------------------------------------------------------
// Функции отрисовки
......@@ -1272,27 +1291,43 @@ ParaMath.prototype =
Get_WordStartPos : function(SearchPos, ContentPos, Depth, UseContentPos)
{
// TODO: ParaMath.Get_StartEndPos
this.Root.Get_WordStartPos(SearchPos, ContentPos, Depth, UseContentPos);
},
Get_WordEndPos : function(SearchPos, ContentPos, Depth, UseContentPos, StepEnd)
{
// TODO: ParaMath.Get_WordEndPos
this.Root.Get_WordEndPos(SearchPos, ContentPos, Depth, UseContentPos, StepEnd);
},
Get_EndRangePos : function(_CurLine, _CurRange, SearchPos, Depth)
{
// TODO: ParaMath.Get_EndRangePos
// Сделать для случая, когда формула будет занимать несколько строк
this.Root.Get_EndPos(false, SearchPos, Depth);
},
Get_StartRangePos : function(_CurLine, _CurRange, SearchPos, Depth)
{
// TODO: ParaMath.Get_StartRangePos
// Сделать для случая, когда формула будет занимать несколько строк, переделать
this.Root.Get_StartPos(SearchPos, Depth);
},
Get_StartRangePos2 : function(_CurLine, _CurRange, ContentPos, Depth)
{
// TODO: ParaMath.Get_StartRangePos2
// Сделать для случая, когда формула будет занимать несколько строк, переделать
this.Root.Get_StartPos(ContentPos, Depth);
},
Get_StartPos : function(ContentPos, Depth)
......
......@@ -4293,7 +4293,7 @@ ParaRun.prototype =
TextPr.Merge(MPrp); // bold, italic
}
this.Parent.Composition.ApplyArgSize(TextPr);
this.Parent.ParaMath.ApplyArgSize(TextPr);
}
else
TextPr.Merge( this.Pr ); // Мержим прямые настройки данного рана
......@@ -4553,6 +4553,14 @@ ParaRun.prototype =
// В данной функции мы применяем приходящие настройки поверх старых, т.е. старые не удаляем
Apply_Pr : function(TextPr)
{
if(this.typeObj == MATH_PARA_RUN)
{
this.MathPrp.Apply_Pr(TextPr);
this.Recalc_CompiledPr(true);
return;
}
if ( undefined != TextPr.Bold )
this.Set_Bold( null === TextPr.Bold ? undefined : TextPr.Bold );
......@@ -7004,8 +7012,7 @@ CRunCollaborativeMarks.prototype =
{
this.Ranges.splice( Index, 1 );
Len--;
Index--;
continue;
Index--;continue;
}
else
{
......@@ -7090,12 +7097,14 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
}
}
ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, RecalcInfo)
{
var RangeStartPos = 0;
var RangeEndPos = this.Content.length;
this.Parent = RecalcInfo.Parent;
this.Paragraph = Paragraph;
this.Parent = Parent;
// обновляем позиции start и end для Range
this.Lines[0].Add_Range(0, RangeStartPos, RangeEndPos);
......@@ -7120,8 +7129,7 @@ ParaRun.prototype.Math_Recalculate = function(RecalcInfo)
RecalcInfo.Current = this.Content[Pos];
RecalcInfo.setGaps();
this.Content[Pos].relate(this);
this.Content[Pos].Resize(g_oTextMeasurer);
this.Content[Pos].Resize(this, oMeasure);
var oSize = this.Content[Pos].size;
width += oSize.width;
......
......@@ -26,7 +26,7 @@ CCircumflex.prototype.init = function(props)
}
CCircumflex.prototype.fixSize = function(oMeasure, stretch, bIncl)
{
var alpha = this.Parent.getCtrPrp().FontSize/36;
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 3.88*alpha;
var height = 3.175*alpha;
......@@ -78,7 +78,7 @@ CCircumflex.prototype.draw = function(x, y, pGraphics)
var xx = this.pos.x + x,
yy = this.pos.y + y;
var fontSize = this.Parent.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
penW *= 96/25.4;
......@@ -190,7 +190,7 @@ function CAccentCircumflex()
extend(CAccentCircumflex, CGlyphOperator);
CAccentCircumflex.prototype.calcSize = function(stretch)
{
var alpha = this.getCtrPrp().FontSize/36;
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 3.88*alpha;
var height = 3.175*alpha;
......@@ -208,7 +208,7 @@ CAccentCircumflex.prototype.calcSize = function(stretch)
}
CAccentCircumflex.prototype.calcCoord = function(stretch)
{
var fontSize = this.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
//var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4;
......@@ -297,7 +297,7 @@ CLine.prototype.init = function(props)
}
CLine.prototype.fixSize = function(oMeasure, stretch)
{
var alpha = this.Parent.getCtrPrp().FontSize/36;
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var height = 1.68*alpha;
var width = 4.938*alpha;
......@@ -308,7 +308,7 @@ CLine.prototype.fixSize = function(oMeasure, stretch)
}
CLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4;
......@@ -348,7 +348,7 @@ function CAccentLine()
extend(CAccentLine, CGlyphOperator);
CAccentLine.prototype.calcSize = function(stretch)
{
var alpha = this.Parent.getCtrPrp().FontSize/36;
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var height = 1.68*alpha;
var width = 4.938*alpha;
......@@ -359,7 +359,7 @@ CAccentLine.prototype.calcSize = function(stretch)
}
CAccentLine.prototype.calcCoord = function(stretch)
{
var fontSize = this.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var X = new Array(),
Y = new Array();
......@@ -395,7 +395,7 @@ CDoubleLine.prototype.init = function(props)
}
CDoubleLine.prototype.fixSize = function(oMeasure, stretch)
{
var alpha = this.Parent.getCtrPrp().FontSize/36;
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var height = 2.843*alpha;
var width = 4.938*alpha;
......@@ -410,7 +410,7 @@ CDoubleLine.prototype.setPosition = function(pos)
}
CDoubleLine.prototype.draw = function(x, y, pGraphics)
{
var fontSize = this.Parent.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var penW = fontSize*g_dKoef_pt_to_mm*this.PEN_W;
//penW *= 96/25.4;
......@@ -448,7 +448,7 @@ function CAccentDoubleLine()
extend(CAccentDoubleLine, CGlyphOperator);
CAccentDoubleLine.prototype.calcSize = function(stretch)
{
var alpha = this.getCtrPrp().FontSize/36;
var alpha = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var height = 2.843*alpha;
var width = 4.938*alpha;
......@@ -459,7 +459,7 @@ CAccentDoubleLine.prototype.calcSize = function(stretch)
}
CAccentDoubleLine.prototype.calcCoord = function(stretch)
{
var fontSize = this.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var X = new Array(),
Y = new Array();
......@@ -508,7 +508,7 @@ CTilde.prototype.init = function(props)
}
CTilde.prototype.fixSize = function()
{
var betta = this.Parent.getCtrPrp().FontSize/36;
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999
var height = 2.469444444444444*betta;
......@@ -552,7 +552,7 @@ CTilde.prototype.draw = function(x, y, pGraphics)
var XX = new Array(),
YY = new Array();
var fontSize = this.Parent.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
......@@ -614,7 +614,7 @@ function CAccentTilde()
extend(CAccentTilde, CGlyphOperator);
CAccentTilde.prototype.calcSize = function(stretch)
{
var betta = this.getCtrPrp().FontSize/36;
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 9.047509765625*betta; // реальная на отрисовке width 7.495282031249999
var height = 2.469444444444444*betta;
......@@ -658,7 +658,7 @@ CAccentTilde.prototype.calcCoord = function(stretch)
var XX = new Array(),
YY = new Array();
var fontSize = this.Parent.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
......@@ -703,7 +703,7 @@ CBreve.prototype.init = function(props)
}
CBreve.prototype.fixSize = function()
{
var betta = this.Parent.getCtrPrp().FontSize/36;
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 4.2333333333333325*betta;
var height = 2.469444444444445*betta;
......@@ -747,7 +747,7 @@ CBreve.prototype.draw = function(x, y, pGraphics)
var XX = new Array(),
YY = new Array();
var fontSize = this.Parent.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
......@@ -816,7 +816,7 @@ function CAccentBreve()
extend(CAccentBreve, CGlyphOperator);
CAccentBreve.prototype.calcSize = function(stretch)
{
var betta = this.getCtrPrp().FontSize/36;
var betta = this.Parent.Get_CompiledCtrPrp().FontSize/36;
var width = 4.2333333333333325*betta;
var height = 2.469444444444445*betta;
......@@ -856,7 +856,7 @@ CAccentBreve.prototype.calcCoord = function(stretch)
var XX = new Array(),
YY = new Array();
var fontSize = this.getCtrPrp().FontSize;
var fontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var textScale = fontSize/1000, // 1000 pt
alpha = textScale*25.4/96 /64 ; // g_dKoef_px_to_mm = 25.4/96
......@@ -961,10 +961,10 @@ CSign.prototype.setPosition = function(pos)
}*/
CSign.prototype.fixSize = function(oMeasure, stretch, bIncline)
{
var ctrPrp = this.Parent.getCtrPrp();
var ctrPrp = this.Parent.Get_CompiledCtrPrp();
var rPrp = new CTextPr();
var defaultRPrp = this.Parent.Composition.Get_Default_TPrp();
var defaultRPrp = this.Parent.ParaMath.Get_Default_TPrp();
rPrp.Merge(defaultRPrp);
rPrp.Merge(ctrPrp);
rPrp.Italic = false; // не меняем значок
......@@ -972,7 +972,7 @@ CSign.prototype.fixSize = function(oMeasure, stretch, bIncline)
oMeasure.SetFont(rPrp);
this.sign.Resize(oMeasure);
this.sign.Resize(this, oMeasure);
/*if(this.typeOper == ACCENT_THREE_DOTS)
this.dH = 1.2*ctrPrp.FontSize/36;
......@@ -1604,25 +1604,34 @@ CAccent.prototype.getPropsForWrite = function()
return props;
}
CAccent.prototype.Resize = function(oMeasure)
CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
if(this.RecalcInfo.bCtrPrp == true)
{
this.Set_CompiledCtrPrp();
this.RecalcInfo.bCtrPrp = false;
}
var base = this.elements[0][0];
base.Resize(oMeasure);
base.Resize(this, ParaMath, oMeasure);
this.operator.fixSize(oMeasure, base.size.width);
var ctrPrp = this.Get_CompiledCtrPrp();
oMeasure.SetFont(ctrPrp);
this.operator.fixSize(ParaMath, oMeasure, base.size.width);
var letterX = new CMathText(true);
letterX.add(0x78);
letterX.Resize(oMeasure);
letterX.Resize(null, oMeasure);
this.shiftX = base.size.ascent - letterX.size.ascent;
var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width,
height = base.size.height + this.operator.size.height + this.shiftX,
ascent = this.getAscent(oMeasure);
var ctrPrp = this.mergeCtrTPrp();
oMeasure.SetFont(ctrPrp);
this.size = {height: height, width: width, ascent: ascent};
}
CAccent.prototype.getBase = function()
......@@ -1633,8 +1642,8 @@ CAccent.prototype.draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(x, y, pGraphics);
var mgCtrPrp = this.mergeCtrTPrp();
var FontSize = mgCtrPrp.FontSize,
var MergedCtrPrp = this.Get_CompiledCtrPrp();
var FontSize = MergedCtrPrp.FontSize,
FontFamily = {Name: "Cambria Math", Index: -1};
var obj = {FontSize: FontSize, FontFamily: FontFamily};
......
This diff is collapsed.
......@@ -75,7 +75,7 @@ CBorderBox.prototype.recalculateSize = function()
var height = base.height;
var ascent = base.ascent;
this.gapBrd = this.getCtrPrp().FontSize*0.08104587131076388;
this.gapBrd = this.Get_CompiledCtrPrp().FontSize*0.08104587131076388;
if(this.bTop)
{
......@@ -97,8 +97,8 @@ CBorderBox.prototype.recalculateSize = function()
CBorderBox.prototype.draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(x, y, pGraphics);
//var penW = this.getCtrPrp().FontSize* 25.4/72 * 0.06 ;
var penW = this.getCtrPrp().FontSize*0.02;
//var penW = this.Get_CompiledCtrPrp().FontSize* 25.4/72 * 0.06 ;
var penW = this.Get_CompiledCtrPrp().FontSize*0.02;
if(this.bTop)
{
......
......@@ -68,7 +68,7 @@ CDegree.prototype.old__recalculateSup = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var height = 0,
......@@ -109,12 +109,12 @@ CDegree.prototype.old_recalculateSubScript = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
/*var FontSize = this.getCtrPrp().FontSize,
/*var FontSize = this.Get_CompiledCtrPrp().FontSize,
shiftCenter = 0.5*DIV_CENT*FontSize;*/
//var ctrPrp = this.getCtrPrp(); // выставить потом размер шрифта для итератора
//var ctrPrp = this.Get_CompiledCtrPrp(); // выставить потом размер шрифта для итератора
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var width = base.width + iter.width + this.dW;
......@@ -143,8 +143,8 @@ CDegree.prototype.recalculateSup = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
var mgCtrPrp = this.mergeCtrTPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
this.upBase = 0;
this.upIter = 0;
......@@ -192,8 +192,8 @@ CDegree.prototype.recalculateSubScript = function(oMeasure)
var base = this.elements[0][0].size,
iter = this.elements[0][1].size;
var mgCtrPrp = this.mergeCtrTPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
var width = base.width + iter.width + this.dW;
width += this.GapLeft + this.GapRight;
......@@ -541,7 +541,7 @@ CIterators.prototype.old_old_setDistanceIters = function(oMeasure)
var upIter = this.elements[0][0].size,
lowIter = this.elements[1][0].size;
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
......@@ -580,7 +580,7 @@ CIterators.prototype.old_setDistanceIters = function(oMeasure)
var upIter = this.elements[0][0].size,
lowIter = this.elements[1][0].size;
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
......@@ -620,7 +620,7 @@ CIterators.prototype._setDistanceIters = function(oMeasure)
var upIter = this.elements[0][0].size,
lowIter = this.elements[1][0].size;
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
......@@ -649,9 +649,9 @@ CIterators.prototype.getLowerIterator = function()
{
return this.elements[1][0];
}
CIterators.prototype.getCtrPrp = function()
CIterators.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.getCtrPrp();
return this.Parent.Get_CompiledCtrPrp();
}
CIterators.prototype.Save_Changes = function(Data, Writer)
{
......@@ -777,7 +777,7 @@ CDegreeSubSup.prototype.init = function(props)
}*/
CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure)
{
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
shCenter *= 1.2;
......@@ -820,7 +820,7 @@ CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure)
}
CDegreeSubSup.prototype.old_recalculateSize = function(oMeasure)
{
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
shCenter *= 1.2;
......@@ -849,7 +849,7 @@ CDegreeSubSup.prototype.old_recalculateSize = function(oMeasure)
var lUp = base.size.ascent - shCenter; // center of base
var lDown = base.size.height - lUp; // height - center of base
var ctrPrpIter = iters.mergeCtrTPrp();
var ctrPrpIter = iters.Get_CompiledCtrPrp();
var shIter = this.Composition.GetShiftCenter(oMeasure, ctrPrpIter); //смещение
//var upDesc = iterUp.height - iterUp.ascent + 1.2*shIter, // смещенный descent верхнего итератора
......@@ -901,7 +901,7 @@ CDegreeSubSup.prototype.old_recalculateSize = function(oMeasure)
}
CDegreeSubSup.prototype._recalculateSize = function(oMeasure)
{
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
shCenter *= 1.4;
......@@ -930,7 +930,7 @@ CDegreeSubSup.prototype._recalculateSize = function(oMeasure)
var lUp = base.size.ascent - shCenter; // center of base
var lDown = base.size.height - lUp; // height - center of base
var ctrPrpIter = iters.mergeCtrTPrp();
var ctrPrpIter = iters.Get_CompiledCtrPrp();
var shIter = this.Composition.GetShiftCenter(oMeasure, ctrPrpIter); //смещение
//var upDesc = iterUp.height - iterUp.ascent + 1.2*shIter, // смещенный descent верхнего итератора
......@@ -1015,9 +1015,9 @@ CDegreeSubSup.prototype._recalculateSize = function(oMeasure)
}
CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
{
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var shCenter = this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
shCenter *= 1.4;
var iters, base;
......@@ -1041,8 +1041,8 @@ CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
var lUp = base.size.ascent - shCenter; // center of base
var lDown = base.size.height - lUp; // height - center of base
var ctrPrpIter = iters.mergeCtrTPrp();
var shIter = this.Composition.GetShiftCenter(oMeasure, ctrPrpIter); //смещение
var ctrPrpIter = iters.Get_CompiledCtrPrp();
var shIter = this.ParaMath.GetShiftCenter(oMeasure, ctrPrpIter); //смещение
var minGap = 0.7*shIter;
......
......@@ -71,7 +71,7 @@ CFraction.prototype.draw = function(x, y, pGraphics)
}
CFraction.prototype.drawBarFraction = function(x, y, pGraphics)
{
var mgCtrPrp = this.mergeCtrTPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var penW = mgCtrPrp.FontSize* 25.4/96 * 0.08;
var numHeight = this.elements[0][0].size.height;
......@@ -112,8 +112,8 @@ CFraction.prototype.drawBarFraction = function(x, y, pGraphics)
}
CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics)
{
//var ctrPrp = this.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var penW = mgCtrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
......@@ -211,8 +211,8 @@ CFraction.prototype.drawLinearFraction = function(x, y, pGraphics)
x2 = this.pos.x + x + this.elements[0][0].size.width + shift,
y2 = this.pos.y + y + this.size.height;
//var ctrPrp = this.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var penW = mgCtrPrp.FontSize/12.5*g_dKoef_pix_to_mm;
pGraphics.SetFont(mgCtrPrp);
......@@ -264,12 +264,12 @@ CFraction.prototype.recalculateBarFraction = function(oMeasure)
var num = this.elements[0][0].size,
den = this.elements[1][0].size;
//var ctrPrp = this.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var width = num.width > den.width ? num.width : den.width;
var height = num.height + den.height;
var ascent = num.height + this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var ascent = num.height + this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
width += this.GapLeft + this.GapRight;
......@@ -277,13 +277,13 @@ CFraction.prototype.recalculateBarFraction = function(oMeasure)
}
CFraction.prototype.recalculateSkewed = function(oMeasure)
{
//var ctrPrp = this.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
this.gapSlash = 5.011235894097222 * mgCtrPrp.FontSize/36;
var width = this.elements[0][0].size.width + this.gapSlash + this.elements[0][1].size.width;
var height = this.elements[0][0].size.height + this.elements[0][1].size.height;
var ascent = this.elements[0][0].size.height + this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var ascent = this.elements[0][0].size.height + this.ParaMath.GetShiftCenter(oMeasure, mgCtrPrp);
width += this.GapLeft + this.GapRight;
......@@ -297,8 +297,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.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var gap = 5.011235894097222*mgCtrPrp.FontSize/36;
......@@ -476,8 +476,8 @@ CNumerator.prototype.recalculateSize = function()
{
var arg = this.elements[0][0].size;
//var ctrPrp = this.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var Descent = arg.height - arg.ascent; // baseLine
var gapNum = 7.832769097222222 * mgCtrPrp.FontSize/36,
......@@ -517,13 +517,9 @@ CNumerator.prototype.getElement = function()
{
return this.elements[0][0];
}
CNumerator.prototype.getCtrPrp = function()
CNumerator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.getCtrPrp();
}
CNumerator.prototype.getRunPrp = function()
{
return this.Parent.getRunPrp();
return this.Parent.Get_CompiledCtrPrp();
}
CNumerator.prototype.getPropsForWrite = function()
{
......@@ -549,8 +545,8 @@ CDenominator.prototype.init = function()
CDenominator.prototype.recalculateSize = function()
{
var arg = this.elements[0][0].size;
//var ctrPrp = this.getCtrPrp();
var mgCtrPrp = this.mergeCtrTPrp();
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var gapDen = 7.325682539682539 * mgCtrPrp.FontSize/36,
Ascent = arg.ascent - 4.938888888888888*mgCtrPrp.FontSize/36,
......@@ -596,13 +592,9 @@ CDenominator.prototype.getElement = function(txt)
{
return this.elements[0][0];
}
CDenominator.prototype.getCtrPrp = function()
{
return this.Parent.getCtrPrp();
}
CDenominator.prototype.getRunPrp = function()
CDenominator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.getRunPrp();
return this.Parent.Get_CompiledCtrPrp();
}
CDenominator.prototype.getPropsForWrite = function()
{
......
......@@ -5,8 +5,6 @@ function CLimit(props)
this.type = LIMIT_LOW;
CMathBase.call(this);
this.init(props);
if(props.type === LIMIT_UP || props.type === LIMIT_LOW)
this.type = props.type;
......@@ -61,7 +59,7 @@ CLimit.prototype.getIterator = function()
}
CLimit.prototype.setDistance = function()
{
this.dH = 0.03674768518518519*this.getCtrPrp().FontSize;
this.dH = 0.03674768518518519*this.Get_CompiledCtrPrp().FontSize;
}
CLimit.prototype.getPropsForWrite = function()
{
......@@ -123,7 +121,7 @@ function CMathFunc(props)
extend(CMathFunc, CMathBase);
CMathFunc.prototype.setDistance = function()
{
this.dW = this.getCtrPrp().FontSize/6*g_dKoef_pt_to_mm;
this.dW = this.Get_CompiledCtrPrp().FontSize/6*g_dKoef_pt_to_mm;
}
CMathFunc.prototype.getFName = function()
{
......
This diff is collapsed.
......@@ -235,7 +235,7 @@ CMathText.prototype =
{
this.bIterator = bIterator; // символы другие , чуть толще
},
Resize: function(oMeasure)
Resize: function(Run, oMeasure)
{
/*
var metricsTxt = g_oTextMeasurer.Measure2Code(letter);
......@@ -243,6 +243,8 @@ CMathText.prototype =
height = g_oTextMeasurer.GetHeight();
*/
this.Parent = Run;
var letter = this.getCode();
var metricsTxt;
......
......@@ -184,7 +184,7 @@ CMathMatrix.prototype.setRuleGap = function(space, rule, gap, minGap)
}
CMathMatrix.prototype.recalculateSize = function(oMeasure)
{
var txtPrp = this.mergeCtrTPrp();
var txtPrp = this.Get_CompiledCtrPrp();
var interval = this.getLineGap(txtPrp);
this.gaps.column[0] = 0;
......@@ -392,8 +392,7 @@ CMathMatrix.prototype.addRow = function()
for(var j = 0; j < this.nCol; j++)
{
this.elements[this.nRow-1][j] = new CMathContent();
this.elements[this.nRow-1][j].relate(this);
this.elements[this.nRow-1][j].setComposition(this.Composition);
//this.elements[this.nRow-1][j].relate(this);
//this.elements[this.nRow-1][j].setComposition(this.Composition);
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -65,7 +65,7 @@ function CSignRadical()
}
CSignRadical.prototype.new_draw = function(x, y, pGraphics)
{
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
//var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
......@@ -158,7 +158,7 @@ CSignRadical.prototype.new_draw = function(x, y, pGraphics)
}
CSignRadical.prototype.draw = function(x, y, pGraphics)
{
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
//var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
......@@ -256,7 +256,7 @@ CSignRadical.prototype.draw = function(x, y, pGraphics)
}
CSignRadical.prototype.recalculateSize = function()
{
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
......@@ -380,7 +380,7 @@ CSignRadical.prototype.recalculateSize = function()
}
CSignRadical.prototype.old_recalculateSize = function()
{
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
......@@ -559,7 +559,7 @@ CSignRadical.prototype.old_recalculateSize = function()
}
CSignRadical.prototype.old_old_recalculateSize = function()
{
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
......@@ -719,7 +719,7 @@ CSignRadical.prototype.old_old_recalculateSize = function()
}
CSignRadical.prototype.old_draw = function(x, y, pGraphics)
{
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
//var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
......@@ -794,7 +794,7 @@ CSignRadical.prototype.old_draw = function(x, y, pGraphics)
CSignRadical.prototype.old_recalculateSize = function()
{
//var txtPrp = this.Parent.getTxtPrp();
var txtPrp = this.Parent.getCtrPrp();
var txtPrp = this.Parent.Get_CompiledCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
......@@ -939,7 +939,7 @@ CRadical.prototype.recalculateSize = function(oMeasure)
{
this.signRadical.recalculateSize(oMeasure);
var txtPrp = this.getCtrPrp();
var txtPrp = this.Get_CompiledCtrPrp();
var sign = this.signRadical.size,
gSign = this.signRadical.gapSign,
// в случае смещения baseline контента тоже смещается, и по высоте артгумент может выйти чуть за пределы (т.о. значок интеграла будет расположен чуть выше, чем следовало бы, и размер аргумента выйде за аграницы)
......
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