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

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

2. Переделала ArgSize (рассчитывается на Resize) => CMathArgSize
3. Поправила Get_CompiledTextPr : возникала ошибка при селекте только одного мат объекта 
+ неправильно объединялись настройки (мержились с настройками по умолчанию, поэтому, к примеру, для выделенной части контента при разных размерах шрифта у ранов отдавался 11 размер )
4. Поправила баг: добавлялись лишние пустые раны в контент
5. Поправила радикал : gaps для радикала два раза учитывались => неправильная ширина и неправильная позиция основания
6. Поправила баг для линейной и наклонной дробей, позиции линий у дробей были неправильными (не учитывались gaps)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57428 954022d7-b5bf-4e40-9824-e11837661b57
parent 7d8543a6
......@@ -894,8 +894,9 @@ var historyitem_ParaRun_Lang_Val = 28; // �������� ��
var historyitem_ParaRun_TextPr = 29; // �������� ��� ��������� �������
var historyitem_ParaRun_Unifill = 30; // �������� ��� ��������� �������
var historyitem_ParaRun_Shd = 31;
var historyitem_ParaRun_MathStyle = 32; // Меняем стиль MathPr
var historyitem_ParaRun_MathPrp = 33;
var historyitem_ParaRun_MathStyle = 32; // Меняем свойство style для MathPr
var historyitem_ParaRun_MathPrp = 33; // Меняем MathPr
// Типы изменений в классе ParaTextPr
var historyitem_TextPr_Change = 1; // Изменяем настройку
......
......@@ -15,6 +15,9 @@ function ParaMath()
this.Type = para_Math;
this.MathPara = true; // false - внутристроковая формула, true - формула на отдельной строке (w:oMath/w:oMathPara)
this.OldMathPara = null;
this.Jc = undefined;
//this.Math = new CMathComposition();
//this.Math.Parent = this;
......@@ -60,7 +63,7 @@ function ParaMath()
this.DefaultTextPr.RFonts.Set_All("Cambria Math", -1);
this.MathPr =
/*this.MathPr =
{
naryLim: NARY_UndOvr,
intLim: NARY_SubSup,
......@@ -69,7 +72,7 @@ function ParaMath()
wrapIndent: 0,
smallFrac: false,
wrapRight: false
};
};*/
// Добавляем данный класс в таблицу Id (обязательно в конце конструктора)
g_oTableId.Add( this, this.Id );
......@@ -138,7 +141,6 @@ ParaMath.prototype =
// TODO: ParaMath.Get_CompiledTextPr
var TextPr = new CTextPr();
TextPr.Init_Default();
var oContent = this.GetSelectContent();
var mTextPr = oContent.Content.Get_CompiledTextPr(Copy);
......@@ -446,8 +448,6 @@ ParaMath.prototype =
// Styles.js
// Document_CreateFontMap
//
this.Root.Create_FontMap(Map);
},
......@@ -502,6 +502,11 @@ ParaMath.prototype =
this.StartLine = StartLine;
this.StartRange = StartRange;
this.LinesLength = 0;
if(this.Id == "81")
{
console.log("StartLine " + this.StartLine + " StartRange " + this.StartRange);
}
},
Recalculate_Range : function(PRS, ParaPr, Depth)
......@@ -525,9 +530,16 @@ ParaMath.prototype =
var TextPr = new CTextPr();
TextPr.Init_Default();
//this.Math.RecalculateComposition(g_oTextMeasurer, TextPr);
var RPI = new CRPI();
RPI.bInline = this.MathPara === false;
RPI.bChangeInline = this.MathPara != this.OldMathPara;
var ArgSize = new CMathArgSize();
this.Root.Resize(g_oTextMeasurer, null, this, RPI/*recalculate properties info*/, ArgSize, TextPr);
//this.Root.Resize(null, this, g_oTextMeasurer, RPI/*recalculate properties info*/, TextPr);
this.OldMathPara = this.MathPara;
this.Root.Resize(null, this, g_oTextMeasurer, TextPr);
var pos = new CMathPosition();
pos.x = 0;
......@@ -850,6 +862,15 @@ ParaMath.prototype =
//var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
if(this.Id == "81")
{
console.log("CurLine " + _CurLine +" CurRange " + _CurRange );
console.log("StartLine " + this.StartLine + " StartRange " + this.StartRange);
console.log("Current CurLine "+ CurLine + " Current CurRange " + CurRange);
}
var result = {X: _X + this.Root.size.width};
......@@ -1195,7 +1216,8 @@ ParaMath.prototype =
// CMathComposition => this.Root.draw(this.absPos.x, this.absPos.y , pGraphics);
// this.absPos.x ~> this.X
// this.absPos.y ~> this.Y
this.Root.draw( PDSE.X, PDSE.Y - this.Ascent, PDSE.Graphics );
this.Root.draw( PDSE.X, PDSE.Y - this.Ascent, PDSE.Graphics);
PDSE.X += this.Width;
}
},
......@@ -1356,14 +1378,14 @@ ParaMath.prototype =
this.State.ContentPos = ContentPos.Get(Depth);
/*console.log("Set_ParaContentPos");
console.log("Set_ParaContentPos");
var str = "";
for(var i = 0; i < ContentPos.Data.length; i++)
{
str += ContentPos.Data[i] + " ";
}
console.log(str);*/
console.log(str);
this.Root.Set_ParaContentPos(ContentPos, Depth);
......
......@@ -678,15 +678,7 @@ ParaRun.prototype =
if ( true === UpdateTarget )
{
var CurTextPr;
if(this.Type == para_Math_Run)
{
CurTextPr = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(CurTextPr, this.Parent.argSize);
}
else
CurTextPr = this.Get_CompiledPr(false);
var CurTextPr = this.Get_CompiledPr(false);
g_oTextMeasurer.SetTextPr( CurTextPr, this.Paragraph.Get_Theme() );
g_oTextMeasurer.SetFontSlot( fontslot_ASCII, CurTextPr.Get_FontKoef() );
......@@ -781,15 +773,7 @@ ParaRun.prototype =
if ( true === ReturnTarget )
{
var CurTextPr;
if(this.Type == para_Math_Run)
{
CurTextPr = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(CurTextPr, this.Parent.argSize);
}
else
CurTextPr = this.Get_CompiledPr(false);
var CurTextPr = this.Get_CompiledPr(false);
g_oTextMeasurer.SetTextPr( CurTextPr, this.Paragraph.Get_Theme() );
......@@ -1179,7 +1163,7 @@ ParaRun.prototype =
}
},
Create_FontMap : function(Map)
Create_FontMap : function(Map, ArgSize)
{
// для Math_Para_Pun argSize учитывается, когда мержатся текстовые настройки в Internal_Compile_Pr()
if ( undefined !== this.Paragraph && null !== this.Paragraph )
......@@ -1188,7 +1172,8 @@ ParaRun.prototype =
if(this.Type === para_Math_Run)
{
TextPr = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(TextPr, this.Parent.argSize);
if(this.Parent !== null)
this.Parent.ParaMath.ApplyArgSize(TextPr, ArgSize.value);
}
else
TextPr = this.Get_CompiledPr(false);
......@@ -7515,7 +7500,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
var Y = y + this.size.ascent;
var oWPrp = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.argSize);
this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.Compiled_ArgSz.value);
if(!this.IsNormalText()) // выставляем false, чтобы не применился наклон к спец символам
{
......@@ -7539,7 +7524,7 @@ ParaRun.prototype.Math_Draw = function(x, y, pGraphics)
this.Content[i].draw(X, Y, pGraphics);
}
ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, RecalcInfo)
ParaRun.prototype.Math_Recalculate = function(oMeasure, Parent, Paragraph, RPI, ArgSize)
{
// пересчет элементов контента в Run
// Recalculate_MeasureContent
......@@ -7568,7 +7553,7 @@ ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, Recal
var oWPrp = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.argSize);
this.Parent.ParaMath.ApplyArgSize(oWPrp, ArgSize.value);
if(!this.IsNormalText()) // выставляем false, чтобы не применился наклон к спец символам
{
......@@ -7587,7 +7572,7 @@ ParaRun.prototype.Math_Recalculate = function(Parent, Paragraph, oMeasure, Recal
for (var Pos = 0 ; Pos < this.Content.length; Pos++ )
{
this.Content[Pos].Resize(this, oMeasure);
this.Content[Pos].Resize(oMeasure, this);
this.Content[Pos].ApplyGaps();
var oSize = this.Content[Pos].size;
......@@ -7606,7 +7591,7 @@ ParaRun.prototype.Math_Update_Cursor = function(X, Y, CurPage, UpdateTarget)
// TODO
// поставить заглушку на плейсхолдер, когда при перемещении всегда будет отрисовываться селект на плейсхолдере
var runPrp = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(runPrp, this.Parent.argSize);
//this.Parent.ParaMath.ApplyArgSize(runPrp, this.Parent.argSize);
var sizeCursor = runPrp.FontSize*g_dKoef_pt_to_mm;
......@@ -7700,13 +7685,13 @@ ParaRun.prototype.getPropsForWrite = function()
return {wRPrp: wRPrp, mathRPrp: mathRPrp};
}
ParaRun.prototype.Math_SetGaps = function(Parent, Paragraph, RecalcInfo)
ParaRun.prototype.Math_SetGaps = function(Parent, Paragraph, GapsInfo)
{
this.Parent = Parent;
this.Paragraph = Paragraph;
var oWPrp = this.Get_CompiledPr(true);
this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.argSize);
//this.Parent.ParaMath.ApplyArgSize(oWPrp, this.Parent.argSize);
/*if(!this.IsNormalText()) // выставляем false, чтобы не применился наклон к спец символам
{
......@@ -7714,16 +7699,16 @@ ParaRun.prototype.Math_SetGaps = function(Parent, Paragraph, RecalcInfo)
oWPrp.Bold = false;
}*/
g_oTextMeasurer.SetFont(oWPrp);
//g_oTextMeasurer.SetFont(oWPrp);
for (var Pos = 0 ; Pos < this.Content.length; Pos++ )
{
RecalcInfo.leftRunPrp = RecalcInfo.currRunPrp;
RecalcInfo.Left = RecalcInfo.Current;
GapsInfo.leftRunPrp = GapsInfo.currRunPrp;
GapsInfo.Left = GapsInfo.Current;
RecalcInfo.currRunPrp = oWPrp;
RecalcInfo.Current = this.Content[Pos];
RecalcInfo.setGaps();
GapsInfo.currRunPrp = oWPrp;
GapsInfo.Current = this.Content[Pos];
GapsInfo.setGaps();
}
}
ParaRun.prototype.IsPlaceholder = function()
......
......@@ -471,7 +471,7 @@ CSign.prototype.fixSize = function(oMeasure, stretch, bIncline)
oMeasure.SetFont(rPrp);
this.sign.Resize(this, oMeasure);
this.sign.Resize(oMeasure);
/*if(this.typeOper == ACCENT_THREE_DOTS)
this.dH = 1.2*ctrPrp.FontSize/36;
......@@ -1096,7 +1096,7 @@ CAccent.prototype.getPropsForWrite = function()
{
return this.Pr;
}
CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
CAccent.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
......@@ -1121,7 +1121,7 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.operator.relate(this);
var base = this.elements[0][0];
base.Resize(this, ParaMath, oMeasure);
base.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ctrPrp = this.Get_CompiledCtrPrp();
oMeasure.SetFont(ctrPrp);
......@@ -1133,7 +1133,7 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
{
var letterX = new CMathText(true);
letterX.add(0x78);
letterX.Resize(null, oMeasure);
letterX.Resize(oMeasure, null);
this.gap = this.operator.size.ascentSign - letterX.size.ascent;
this.shiftX_2 = this.operator.size.ascentSign;
......
"use strict";
function CMathBase()
function CMathBase(bInside)
{
//this.typeObj = MATH_COMP;
this.Type = para_Math_Composition;
......@@ -9,12 +9,14 @@ function CMathBase()
this.size = null;
// Properties
this.argSize = 0;
this.Parent = null;
this.ParaMath = null; // ссылка на общую формулу
this.CtrPrp = new CTextPr();
this.CompiledCtrPrp = new CTextPr();
this.ArgSize = new CMathArgSize();
/////////////////
this.CurPos_X = 0;
......@@ -39,9 +41,8 @@ function CMathBase()
this.nRow = 0;
this.nCol = 0;
// todo
// убрать !!!
this.bMObjs = false;
this.bInside = bInside === true ? true: false;
this.elements = new Array();
......@@ -74,11 +75,7 @@ CMathBase.prototype =
{
this.elements[i] = [];
for(var j = 0; j < this.nCol; j++)
{
this.elements[i][j] = new CMathContent();
//this.elements[i][j].relate(this);
//this.elements[i][j].setComposition(this.Composition);
}
}
},
setDimension: function(countRow, countCol)
......@@ -96,7 +93,9 @@ CMathBase.prototype =
this.alignment.wdt[u] = MCJC_CENTER;*/
for(var i = 0; i < this.nCol ; i++)
{
this.alignment.wdt[i] = MCJC_CENTER;
}
for(var j=0; j < this.nRow; j++)
{
......@@ -113,7 +112,13 @@ CMathBase.prototype =
},
Get_CtrPrp: function()
{
return this.CtrPrp.Copy();
var CtrPrp;
if(this.bInside === true)
CtrPrp = this.Parent.Get_CtrPrp();
else
CtrPrp = this.CtrPrp.Copy();
return CtrPrp;
},
Set_CompiledCtrPrp: function(ParaMath)
{
......@@ -130,14 +135,30 @@ CMathBase.prototype =
},
Get_CompiledCtrPrp: function()
{
var CompiledCtrPrp = this.CompiledCtrPrp.Copy();
this.ParaMath.ApplyArgSize(CompiledCtrPrp, this.argSize);
var CompiledCtrPrp;
if(this.bInside === true)
{
CompiledCtrPrp = this.Parent.Get_CompiledCtrPrp();
}
else
{
CompiledCtrPrp = this.Get_CompiledCtrPrp_2();
this.ParaMath.ApplyArgSize(CompiledCtrPrp, this.Parent.Get_CompiledArgSize().value);
}
this.ParaMath.ApplyArgSize(CompiledCtrPrp, this.ArgSize.value); // для настроек inline формул
return CompiledCtrPrp;
},
Get_CompiledCtrPrp_2: function() // without arg Size
{
return this.CompiledCtrPrp.Copy();
//return this.CompiledCtrPrp.Copy();
},
Get_CompiledArgSize: function()
{
return this.Parent.Get_CompiledArgSize();
},
getCtrPrpForFirst: function(ParaMath)
{
......@@ -174,7 +195,7 @@ CMathBase.prototype =
this.elements[i][j].setRPrp(rPrp);
}
},*/
increaseArgSize: function()
/*increaseArgSize: function()
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
......@@ -201,7 +222,7 @@ CMathBase.prototype =
for(var j = 0; j < this.nCol; j++)
if( !this.elements[i][j].IsJustDraw() )
this.elements[i][j].setArgSize(argSize);
},
},*/
fillPlaceholders: function()
{
for(var i=0; i < this.nRow; i++)
......@@ -209,20 +230,18 @@ CMathBase.prototype =
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].fillPlaceholders();
},
addMCToContent: function()
addMCToContent: function(elements)
{
if(arguments.length == this.nRow*this.nCol)
if(elements.length == this.nRow*this.nCol)
{
this.elements = [];
this.elements.length = 0;
for(var i = 0; i < this.nRow; i++)
{
this.elements[i] = [];
for(var j = 0; j < this.nCol; j++)
{
this.elements[i][j] = arguments[j + i*this.nCol];
//this.elements[i][j].relate(this);
//this.elements[i][j].setComposition(this.Composition);
this.elements[i][j].bMObjs = true;
this.elements[i][j] = elements[j + i*this.nCol];
//this.elements[i][j].bMObjs = true;
}
}
}
......@@ -525,7 +544,7 @@ CMathBase.prototype =
{
this.pos.x = pos.x;
if(this.bMObjs === true)
if(this.bInside === true)
this.pos.y = pos.y;
else
this.pos.y = pos.y - this.size.ascent; ///!!!!
......@@ -588,16 +607,16 @@ CMathBase.prototype =
this.size = {width: width, height: height, ascent: ascent};
},
Resize: function(Parent, ParaMath, oMeasure)
Resize: function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].Resize(this, ParaMath, oMeasure);
this.elements[i][j].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.recalculateSize(oMeasure); // передаем oMeasure, для
this.recalculateSize(oMeasure, RPI);
},
CompiledCtrPrp: function()
{
......@@ -819,7 +838,7 @@ CMathBase.prototype =
return content;
},*/
getGapsInside: function(RecalcInfo)
getGapsInside: function(GapsInfo)
{
var kind = this.kind;
var gaps = {left: 0, right: 0};
......@@ -828,7 +847,7 @@ CMathBase.prototype =
if(checkBase)
{
var base = this.getBase();
gaps = base.getGapsInside(RecalcInfo);
gaps = base.getGapsInside(GapsInfo);
}
return gaps;
......@@ -1035,19 +1054,19 @@ CMathBase.prototype =
{
return this.elements[this.CurPos_X][this.CurPos_Y].IsCurrentPlh();
},
SetGaps: function(Parent, ParaMath, RecalcInfo)
SetGaps: function(Parent, ParaMath, GapsInfo)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
RecalcInfo.Left = RecalcInfo.Current;
RecalcInfo.leftRunPrp = RecalcInfo.currRunPrp;
GapsInfo.Left = GapsInfo.Current;
GapsInfo.leftRunPrp = GapsInfo.currRunPrp;
RecalcInfo.Current = this;
RecalcInfo.currRunPrp = this.Get_CompiledCtrPrp();
GapsInfo.Current = this;
GapsInfo.currRunPrp = this.Get_CompiledCtrPrp();
RecalcInfo.setGaps();
GapsInfo.setGaps();
},
ApplyGaps: function()
......@@ -1292,14 +1311,16 @@ CMathBase.prototype =
{
var props = Common_CopyObj(this.Pr);
props.ctrPrp = this.CtrPrp.Copy();
var NewObj = new this.constructor();
NewObj.init(props);
NewObj.argSize = this.argSize;
//NewObj.argSize = this.argSize;
//NewObj.Composition = Composition;
var CtrPrp = this.CtrPrp.Copy();
//var CtrPrp = this.CtrPrp.Copy();
NewObj.setCtrPrp(CtrPrp);
//NewObj.setCtrPrp(CtrPrp);
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
......@@ -1324,14 +1345,17 @@ CMathBase.prototype =
var TextPr = null;
while(start_x < this.nCol && start_y < this.nRow && (TextPr == null || this.elements[start_x][start_y].IsJustDraw() ))
while(start_x < this.nRow && start_y < this.nCol && (TextPr == null || this.elements[start_x][start_y].IsJustDraw() ))
{
if(!this.elements[start_x][start_y].IsJustDraw())
{
TextPr = this.elements[start_x][start_y].Get_CompiledTextPr(Copy, true);
break;
}
start_y++;
if(start_y >= this.nCol)
if(start_y == this.nCol)
{
start_x++;
start_y = 0;
......
......@@ -601,8 +601,18 @@ CBox.prototype.fillContent = function()
this.setDimension(1, 1);
this.setContent();
/*if(this.Pr.opEmu)
this.elements[0][0].decreaseArgSize();*/
}
CBox.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
var CurrArgSize = new CMathArgSize();
CurrArgSize.Merge(ArgSize);
if(this.Pr.opEmu)
this.elements[0][0].decreaseArgSize();
CurrArgSize.decrease();
CBox.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, CurrArgSize);
}
CBox.prototype.setProperties = function(props)
{
......@@ -750,7 +760,7 @@ CBar.prototype.fillContent = function()
this.setDimension(1, 1);
this.setContent();
}
CBar.prototype.Resize = function(Parent, ParaMath, oMeasure)
CBar.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
if(this.RecalcInfo.bProps == true)
{
......@@ -769,7 +779,7 @@ CBar.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.RecalcInfo.bProps = false;
}
CBar.superclass.Resize.call(this, Parent, ParaMath, oMeasure);
CBar.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
}
CBar.prototype.getAscent = function()
{
......
"use strict";
function CDegree(props)
function CDegree(props, bInside)
{
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREE;
......@@ -13,7 +13,7 @@ function CDegree(props)
type: DEGREE_SUPERSCRIPT
};
CMathBase.call(this);
CMathBase.call(this, bInside);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -27,29 +27,46 @@ CDegree.prototype.init = function(props)
this.fillContent();
}
CDegree.prototype.fillContent = function()
{
this.setDimension(1, 2);
this.setContent();
}
/*CDegree.prototype.fillContent = function()
{
var oBase = new CMathContent();
/*if(props.indef == 2) /// props include Base for CNary
{
oBase = props.oBase;
oBase.setCtrPrp(props.ctrPrp);
}*/
this.setDimension(1, 2);
var oDegree = new CMathContent();
oDegree.decreaseArgSize();
this.addMCToContent(oBase, oDegree);
}
CDegree.prototype.recalculateSize = function(oMeasure)
this.addMCToContent([oBase, oDegree]);
}*/
CDegree.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ArgSzDegr = new CMathArgSize();
ArgSzDegr.decrease();
this.elements[0][1].Resize(oMeasure, this, ParaMath, RPI, ArgSzDegr);
if(this.Pr.type === DEGREE_SUPERSCRIPT)
this.recalculateSup(oMeasure);
else if(this.Pr.type === DEGREE_SUBSCRIPT)
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)
{
var base = this.elements[0][0].size,
......@@ -217,7 +234,7 @@ CDegree.prototype.setPosition = function(pos)
{
this.pos.x = pos.x;
if(this.bMObjs === true)
if(this.bInside === true)
this.pos.y = pos.y;
else
this.pos.y = pos.y - this.size.ascent;
......@@ -470,15 +487,11 @@ CDegree.prototype.fillMathComposition = function(props, contents /*array*/)
// Iterator
this.elements[0][1] = contents[1];
}
CDegree.prototype.changeBase = function(base)
CDegree.prototype.setBase = function(base)
{
this.elements[0][0] = base;
}
CDegree.prototype.changeUpperIterator = function(iterator)
{
this.elements[0][1] = iterator;
}
CDegree.prototype.changeLowerIterator = function(iterator)
CDegree.prototype.setIterator = function(iterator)
{
this.elements[0][1] = iterator;
}
......@@ -529,7 +542,7 @@ function CIterators()
this.lUp = 0; // центр основания
this.lD = 0; // высота - центр основания
this.upper = 0; // смещение сверху для позиции основания
CMathBase.call(this);
CMathBase.call(this, true);
}
extend(CIterators, CMathBase);
CIterators.prototype.init = function()
......@@ -650,11 +663,11 @@ CIterators.prototype.getLowerIterator = function()
{
return this.elements[1][0];
}
CIterators.prototype.changeUpperIterator = function(iterator)
CIterators.prototype.setUpperIterator = function(iterator)
{
this.elements[0][0] = iterator;
}
CIterators.prototype.changeLowerIterator = function(iterator)
CIterators.prototype.setLowerIterator = function(iterator)
{
this.elements[1][0] = iterator;
}
......@@ -673,7 +686,7 @@ CIterators.prototype.alignIterators = function(mcJc)
}
function CDegreeSubSup(props)
function CDegreeSubSup(props, bInside)
{
this.Id = g_oIdCounter.Get_NewId();
this.kind = MATH_DEGREESubSup;
......@@ -689,7 +702,7 @@ function CDegreeSubSup(props)
//this.type = DEGREE_SubSup;
//this.alnScr = false; // не выровнены, итераторы идут в соответствии с наклоном буквы/мат. объекта
CMathBase.call(this);
CMathBase.call(this, bInside);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -710,7 +723,7 @@ CDegreeSubSup.prototype.fillContent = function()
var oIters = new CIterators();
oIters.init();
oIters.decreaseArgSize();
//oIters.decreaseArgSize();
oIters.lUp = 0;
......@@ -719,14 +732,36 @@ CDegreeSubSup.prototype.fillContent = function()
if(this.Pr.type == DEGREE_SubSup)
{
oIters.alignIterators(MCJC_LEFT);
this.addMCToContent(oBase, oIters);
this.addMCToContent([oBase, oIters]);
}
else if(this.Pr.type == DEGREE_PreSubSup)
{
this.addMCToContent(oIters, oBase);
this.addMCToContent([oIters, oBase]);
oIters.alignIterators(MCJC_RIGHT);
}
}
CDegreeSubSup.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
var ArgSzIters = new CMathArgSize();
ArgSzIters.Merge(ArgSize);
ArgSzIters.decrease();
if(this.Pr.type == DEGREE_SubSup)
{
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.elements[0][1].Resize(oMeasure, this, ParaMath, RPI, ArgSzIters);
}
else
{
this.elements[0][1].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgSzIters);
}
this.recalculateSize(oMeasure, RPI);
}
CDegreeSubSup.prototype.old_old_recalculateSize = function(oMeasure)
{
var mgCtrPrp = this.Get_CompiledCtrPrp();
......@@ -965,7 +1000,7 @@ CDegreeSubSup.prototype._recalculateSize = function(oMeasure)
this.size = {width: width, height: height, ascent: ascent};
}
CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
CDegreeSubSup.prototype.recalculateSize = function(oMeasure, RPI)
{
var mgCtrPrp = this.Get_CompiledCtrPrp();
......@@ -998,10 +1033,18 @@ CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
var minGap = 0.7*shIter;
var up, down;
if(RPI.bNaryInline == true)
{
up = down = 0;
}
else
{
var upDesc = 0,
downAsc = 0;
if(base.IsOnlyText())
if(!base.IsJustDraw() && base.IsOnlyText())
{
upDesc = 1.5*shIter;
downAsc = 1.2*shIter;
......@@ -1012,8 +1055,10 @@ CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
downAsc = iterDown.ascent - shIter;
}
var up = lUp > upDesc ? lUp - upDesc : 0, // расстояние от центра основания до верхнего итератора
up = lUp > upDesc ? lUp - upDesc : 0; // расстояние от центра основания до верхнего итератора
down = lDown > downAsc ? lDown - downAsc : 0; // расстояние от центра основания до нижнего итератора
}
if(up + down > minGap)
......@@ -1037,6 +1082,10 @@ CDegreeSubSup.prototype.recalculateSize = function(oMeasure)
this.size = {width: width, height: height, ascent: ascent};
}
CDegreeSubSup.prototype.setPosition = function(pos)
{
CDegreeSubSup.superclass.setPosition.call(this, pos);
}
CDegreeSubSup.prototype.old_setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
......@@ -1120,19 +1169,26 @@ CDegreeSubSup.prototype.getLowerIterator = function()
return iter;
}
CDegreeSubSup.prototype.changeUpperIterator = function(iterator)
CDegreeSubSup.prototype.setBase = function(base)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][0] = base;
else
this.elements[0][1] = base;
}
CDegreeSubSup.prototype.setUpperIterator = function(iterator)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][1].changeUpperIterator(iterator);
this.elements[0][1].setUpperIterator(iterator);
else
this.elements[0][0].changeUpperIterator(iterator);
this.elements[0][0].setUpperIterator(iterator);
}
CDegreeSubSup.prototype.changeLowerIterator = function(iterator)
CDegreeSubSup.prototype.setLowerIterator = function(iterator)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][1].changeLowerIterator(iterator);
this.elements[0][1].setLowerIterator(iterator);
else
this.elements[0][0].changeLowerIterator(iterator);
this.elements[0][0].setLowerIterator(iterator);
}
CDegreeSubSup.prototype.setProperties = function(props)
{
......@@ -1170,13 +1226,6 @@ CDegreeSubSup.prototype.fillMathComposition = function(props, contents /*array*/
this.elements[0][0].fillMathComposition(contents[1]/*upper iterator*/, contents[2]/*lower iterator*/);
}
}
CDegreeSubSup.prototype.changeBase = function(base)
{
if(this.Pr.type == DEGREE_SubSup)
this.elements[0][0] = base;
else
this.elements[0][1] = base;
}
CDegreeSubSup.prototype.getPropsForWrite = function()
{
return this.Pr;
......
......@@ -10,7 +10,6 @@ function CFraction(props)
type: BAR_FRACTION
};
//this.type = BAR_FRACTION;
this.bHideBar = false;
CMathBase.call(this);
......@@ -41,7 +40,10 @@ CFraction.prototype.draw = function(x, y, pGraphics)
}
CFraction.prototype.drawBarFraction = function(x, y, pGraphics)
{
var mgCtrPrp = this.Get_CompiledCtrPrp();
//var mgCtrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp_2();
this.ParaMath.ApplyArgSize(mgCtrPrp, this.Parent.Get_CompiledArgSize().value);
var penW = mgCtrPrp.FontSize* 25.4/96 * 0.08;
var numHeight = this.elements[0][0].size.height;
......@@ -81,6 +83,9 @@ CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics)
var tg1 = -2.22,
tg2 = -3.7;
var X = this.pos.x + x + this.GapLeft,
Y = this.pos.y + y;
var heightSlash = this.size.height*2/3;
if(heightSlash < maxHeight)
......@@ -104,11 +109,11 @@ CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics)
var x1 = (y1 - b)/tg,
x2 = (y2 - b)/tg;
var xx1 = this.pos.x + x + x1,
xx2 = this.pos.x + x + x2;
var xx1 = X + x1,
xx2 = X + x2;
var yy1 = this.pos.y + y + y1,
yy2 = this.pos.y + y + y2;
var yy1 = Y + y1,
yy2 = Y + y2;
}
else
......@@ -135,11 +140,11 @@ CFraction.prototype.drawSkewedFraction = function(x, y, pGraphics)
var x1 = (y1 - b)/tg,
x2 = (y2 - b)/tg;
var xx1 = this.pos.x + x + x1,
xx2 = this.pos.x + x + x2;
var xx1 = X + x1,
xx2 = X + x2;
var yy1 = this.pos.y + y + y1 ,
yy2 = this.pos.y + y + y2;
var yy1 = Y + y1,
yy2 = Y + y2;
}
......@@ -160,10 +165,13 @@ CFraction.prototype.drawLinearFraction = function(x, y, pGraphics)
{
var shift = 0.1*this.dW;
var x1 = this.pos.x + x + this.elements[0][0].size.width + this.dW - shift,
y1 = this.pos.y + y,
x2 = this.pos.x + x + this.elements[0][0].size.width + shift,
y2 = this.pos.y + y + this.size.height;
var X = this.pos.x + x + this.GapLeft,
Y = this.pos.y + y;
var x1 = X + this.elements[0][0].size.width + this.dW - shift,
y1 = Y,
x2 = X + this.elements[0][0].size.width + shift,
y2 = Y + this.size.height;
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
......@@ -204,6 +212,48 @@ CFraction.prototype.getDenominator = function()
return denominator;
}
/*CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
if(RPI.inline == true && this.Pr.type == BAR_FRACTION)
{
var ArgNum = ArgSize.Copy();
ArgNum.decrease();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgNum);
var ArgDen = ArgSize.Copy();
ArgDen.decrease();
this.elements[1][0].Resize(oMeasure, this, ParaMath, RPI, ArgDen);
this.recalculateSize(oMeasure);
}
else
CFraction.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
}*/
CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
var ArgSzFr = ArgSize.Copy();
if(RPI.bInline == true && this.Pr.type === BAR_FRACTION)
{
ArgSzFr.decrease(); // для контентов числителя и знаменателя
this.ArgSize.SetValue(-1); // для CtrPrp
}
else if(RPI.bInsideFraction == true)
{
this.ArgSize.SetValue(-1); // для CtrPrp
}
var NewRPI = RPI.Copy();
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)
......@@ -395,7 +445,7 @@ CFraction.prototype.fillContent = function()
if(this.Pr.type == NO_BAR_FRACTION)
this.bHideBar = true;
this.addMCToContent(num, den);
this.addMCToContent([num, den]);
}
else if(this.Pr.type == SKEWED_FRACTION)
{
......@@ -494,7 +544,7 @@ function CNumerator()
{
this.gap = 0;
CMathBase.call(this);
CMathBase.call(this, true);
this.init();
}
......@@ -508,7 +558,6 @@ CNumerator.prototype.recalculateSize = function()
{
var arg = this.elements[0][0].size;
//var ctrPrp = this.Get_CompiledCtrPrp();
var mgCtrPrp = this.Get_CompiledCtrPrp();
var Descent = arg.height - arg.ascent; // baseLine
......@@ -550,10 +599,10 @@ CNumerator.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
CNumerator.prototype.Get_CompiledCtrPrp = function()
/*CNumerator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
}
}*/
CNumerator.prototype.getPropsForWrite = function()
{
var props = {};
......@@ -565,7 +614,7 @@ function CDenominator()
{
this.gap = 0;
CMathBase.call(this);
CMathBase.call(this, true);
this.init();
}
......@@ -578,9 +627,10 @@ CDenominator.prototype.init = function()
CDenominator.prototype.recalculateSize = function()
{
var arg = this.elements[0][0].size;
//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,
minGap = gapDen/3;
......@@ -631,10 +681,10 @@ CDenominator.prototype.fillMathComposition = function(content)
{
this.elements[0][0] = content;
}
CDenominator.prototype.Get_CompiledCtrPrp = function()
/*CDenominator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
}
}*/
CDenominator.prototype.getPropsForWrite = function()
{
var props = {};
......
......@@ -6,6 +6,9 @@ function CLimit(props)
this.kind = MATH_LIMIT;
this.FName = new CMathContent();
this.Iterator = new CMathContent();
this.Pr =
{
type: LIMIT_LOW
......@@ -36,23 +39,23 @@ CLimit.prototype.getAscent = function()
}
CLimit.prototype.getFName = function()
{
var fName;
/*var fName;
if(this.Pr.type == LIMIT_LOW)
fName = this.elements[0][0];
else if(this.Pr.type == LIMIT_UP)
fName = this.elements[1][0];
fName = this.elements[1][0];*/
return fName;
return this.FName;
}
CLimit.prototype.getIterator = function()
{
var iterator;
/*var iterator;
if(this.Pr.type == LIMIT_LOW)
iterator = this.elements[1][0];
else if(this.Pr.type == LIMIT_UP)
iterator = this.elements[0][0];
iterator = this.elements[0][0];*/
return iterator;
return this.Iterator;
}
CLimit.prototype.setDistance = function()
{
......@@ -72,12 +75,12 @@ CLimit.prototype.fillContent = function()
var oBase = new CMathContent();
var oIter = new CMathContent();
oIter.decreaseArgSize();
//oIter.decreaseArgSize();
if(this.Pr.type == LIMIT_LOW)
this.addMCToContent(oBase, oIter);
this.addMCToContent([oBase, oIter]);
else if(this.Pr.type == LIMIT_UP)
this.addMCToContent(oIter, oBase);
this.addMCToContent([oIter, oBase]);
}
CLimit.prototype.fillMathComposition = function(props, contents /*array*/)
{
......@@ -102,6 +105,34 @@ CLimit.prototype.fillMathComposition = function(props, contents /*array*/)
}
}
CLimit.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
if(this.RecalcInfo.bProps == true)
{
if(this.Pr.type == LIMIT_LOW)
{
this.elements[0][0] = this.FName;
this.elements[1][0] = this.Iterator;
}
else
{
this.elements[0][0] = this.Iterator;
this.elements[1][0] = this.FName;
}
}
this.FName.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var ArgSzIter = ArgSize.Copy();
ArgSzIter.decrease();
this.Iterator.Resize(oMeasure, this, ParaMath, RPI, ArgSzIter);
this.recalculateSize(oMeasure);
}
CLimit.prototype.getPropsForWrite = function()
{
return this.Pr;
......
This diff is collapsed.
......@@ -488,7 +488,7 @@ CMathText.prototype =
this.Type = para_Math_Placeholder;
this.value = StartTextElement;
},
Resize: function(Run, oMeasure)
Resize: function(oMeasure, Run)
{
/*
var metricsTxt = g_oTextMeasurer.Measure2Code(letter);
......@@ -496,7 +496,10 @@ CMathText.prototype =
height = g_oTextMeasurer.GetHeight();
*/
if(!this.bJustDraw)
this.Parent = Run;
else
this.Parent = null;
var letter = this.getCode();
......@@ -579,7 +582,7 @@ CMathText.prototype =
else // for symbol only drawing
{
this.pos.x = pos.x - this.rasterOffsetX;
this.pos.y = pos.y - this.rasterOffsetY;
this.pos.y = pos.y - this.rasterOffsetY + this.size.ascent;
}
}
catch(e)
......
......@@ -185,7 +185,7 @@ CMathMatrix.prototype.setPosition = function(pos)
{
this.pos.x = pos.x;
if(this.bMObjs === true)
if(this.bInside === true)
this.pos.y = pos.y;
else
this.pos.y = pos.y - this.size.ascent; ///!!!!
......
This diff is collapsed.
......@@ -3064,7 +3064,7 @@ COperator.prototype.fixSize = function(ParaMath, oMeasure, stretch)
oMeasure.SetFont(rPrp);
this.operator.Resize(this, oMeasure);
this.operator.Resize(oMeasure, this);
if(this.operator.loc == 0 || this.operator.loc == 1)
{
......@@ -3147,7 +3147,7 @@ COperator.prototype.setPosition = function(Positions)
if(this.type == OPER_ACCENT)
NewPos.y = this.Positions[0].y + this.shiftAccent + this.operator.size.height;
else
NewPos.y = this.Positions[0].y + this.operator.size.ascent;
NewPos.y = this.Positions[0].y;
/*var operator = this.operator;
......@@ -3463,7 +3463,7 @@ CDelimiter.prototype.old_recalculateSize = function()
this.size = {width: width, height: height, center: center};
}
CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
CDelimiter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
......@@ -3526,7 +3526,7 @@ CDelimiter.prototype.Resize = function(Parent, ParaMath, oMeasure)
for(var j = 0; j < this.nCol; j++)
{
this.elements[0][j].Resize(this, ParaMath, oMeasure);
this.elements[0][j].Resize(oMeasure, this, ParaMath, RPI, ArgSize);
var content = this.elements[0][j].size;
widthG += content.width;
ascentG = content.ascent > ascentG ? content.ascent : ascentG;
......@@ -3956,7 +3956,7 @@ CCharacter.prototype.setCharacter = function(props, defaultProps)
//this.setDimension(1, 1);
//this.setContent();
}
CCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
CCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
......@@ -3968,7 +3968,7 @@ CCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
}*/
var base = this.elements[0][0];
base.Resize(this, ParaMath, oMeasure);
base.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
this.operator.fixSize(ParaMath, oMeasure, base.size.width);
......@@ -4149,7 +4149,7 @@ CGroupCharacter.prototype.init = function(props)
this.Pr.chr = String.fromCharCode(this.operator.code);*/
}
CGroupCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
CGroupCharacter.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
if(this.RecalcInfo.bProps == true)
{
......@@ -4171,7 +4171,7 @@ CGroupCharacter.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.RecalcInfo.bProps = false;
}
CGroupCharacter.superclass.Resize.call(this, Parent, ParaMath, oMeasure);
CGroupCharacter.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
}
CGroupCharacter.prototype.setProperties = function(props)
{
......
......@@ -967,11 +967,12 @@ CRadical.prototype.fillContent = function()
else if(this.Pr.type == DEGREE_RADICAL)
{
this.setDimension(1, 2);
var oBase = new CMathContent();
this.setContent();
/*var oBase = new CMathContent();
var oDegree = new CMathContent();
oDegree.setArgSize(-2);
this.addMCToContent(oDegree, oBase);
this.addMCToContent([oDegree, oBase]);*/
}
}
CRadical.prototype.fillMathComposition = function(props, contents /*array*/)
......@@ -992,18 +993,7 @@ CRadical.prototype.fillMathComposition = function(props, contents /*array*/)
if(this.Pr.degHide == false)
this.elements[0][0] = contents[1];*/
}
CRadical.prototype.Recalculate_Reset = function(StartRange, StartLine)
{
if(this.Iterator != null)
this.Iterator.Recalculate_Reset(StartRange, StartLine);
this.Base.Recalculate_Reset(StartRange, StartLine);
if(this.RealBase != null)
this.RealBase.Recalculate_Reset(StartRange, StartLine);
}
CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
CRadical.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
......@@ -1022,9 +1012,8 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
if(this.Iterator !== null)
{
var Item = new CMathBase();
var Item = new CMathBase(true);
Item.setDimension(1, 2);
Item.bMObjs = true;
Item.elements[0][0] = this.Iterator;
Item.elements[0][1] = this.Base;
......@@ -1045,7 +1034,7 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.elements[0][0] = this.Iterator;
this.elements[0][1] = this.Base;
this.Iterator.setArgSize(-2);
//this.Iterator.setArgSize(-2);
this.RealBase = this.Base;
......@@ -1053,11 +1042,15 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
}
if(this.Pr.type == SQUARE_RADICAL)
this.RealBase.Resize(this, ParaMath, oMeasure);
this.RealBase.Resize(oMeasure, this, ParaMath, RPI, ArgSize);
else
{
this.Iterator.Resize(this, ParaMath, oMeasure);
this.RealBase.Resize(this, ParaMath, oMeasure);
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);
}
var shTop,
......@@ -1085,7 +1078,7 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
ascent = gapBase + shTop + this.RealBase.size.ascent;
//ascent = height - (base.height - base.ascent);
width += this.GapLeft + this.GapRight;
//width += this.GapLeft + this.GapRight;
this.size = {width: width, height: height, ascent: ascent};
}
......@@ -1106,7 +1099,7 @@ CRadical.prototype.Resize = function(Parent, ParaMath, oMeasure)
var wDegree = this.Iterator.size.width > wTick ? this.Iterator.size.width - wTick : 0;
width = wDegree + sign.width + this.gapWidth;
width += this.GapLeft + this.GapRight;
//width += this.GapLeft + this.GapRight;
var gapDegree;
if( this.RealBase.size.height < plH )
......@@ -1145,13 +1138,13 @@ CRadical.prototype.setPosition = function(pos)
if(this.Pr.type == SQUARE_RADICAL)
{
var gapLeft = this.size.width - this.RealBase.size.width;
var gapLeft = this.size.width - this.RealBase.size.width - this.GapRight;
var gapTop = this.size.ascent - this.RealBase.size.ascent;
PosRadical.x = this.pos.x + this.GapLeft;
PosRadical.y = this.pos.y;
PosBase.x = this.pos.x + this.GapLeft + gapLeft;
PosBase.x = this.pos.x + gapLeft;
PosBase.y = this.pos.y + gapTop;
this.signRadical.setPosition(PosRadical);
......@@ -1179,7 +1172,7 @@ CRadical.prototype.setPosition = function(pos)
this.signRadical.setPosition(PosRadical);
PosBase.x = this.pos.x + this.GapLeft + this.size.width - this.RealBase.size.width;
PosBase.x = this.pos.x + this.size.width - this.RealBase.size.width - this.GapRight;
PosBase.y = this.pos.y + this.size.ascent - this.RealBase.size.ascent;
......
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