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

тестовая версия center~> baseline

fraction,
radical,
borderBox,
nary (UndOvr)
delimiters

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@53308 954022d7-b5bf-4e40-9824-e11837661b57
parent 5f2f0f17
......@@ -585,8 +585,8 @@ CMathBase.prototype =
{
var size = this.elements[i][j].size;
Widths[j] = ( Widths[j] > size.width ) ? Widths[j] : size.width;
Ascents[i] = (Ascents[i] > size.center ) ? Ascents[i] : size.center;
Descents[i] = (Descents[i] > size.height - size.center ) ? Descents[i] : size.height - size.center;
Ascents[i] = (Ascents[i] > size.ascent ) ? Ascents[i] : size.ascent;
Descents[i] = (Descents[i] > size.height - size.ascent ) ? Descents[i] : size.height - size.ascent;
}
var Heights = [];
......@@ -632,14 +632,14 @@ CMathBase.prototype =
if(this.alignment.hgt[pos_y] == CENTER)
{
var maxC = 0;
var maxAsc = 0;
for(var j = 0; j < this.nCol; j++)
{
_c = this.elements[pos_x][j].size.center;
maxC = ( maxC > _c ) ? maxC : _c;
var _ascent = this.elements[pos_x][j].size.ascent;
maxAsc = ( maxAsc > _ascent ) ? maxAsc : _ascent;
}
_y = (maxC - this.elements[pos_x][pos_y].size.center);
_y = (maxAsc - this.elements[pos_x][pos_y].size.ascent);
}
else
{
......@@ -772,7 +772,7 @@ CMathBase.prototype =
// -1 - в пределах границы
// 0 - начало контента
// 1 - конец контента
// 2 - выщли за границы контента по Y
// 2 - вышли за границы контента по Y
var inside_flag = -1;
......@@ -815,7 +815,7 @@ CMathBase.prototype =
if(this.bMObjs === true)
this.pos = {x: pos.x, y : pos.y};
else
this.pos = {x: pos.x, y: pos.y - this.size.center}; ///!!!!!!!!!!!!!!!!!!!!!!!!!!
this.pos = {x: pos.x, y: pos.y - this.size.ascent}; ///!!!!!!!!!!!!!!!!!!!!!!!!!!
var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths;
......@@ -834,11 +834,11 @@ CMathBase.prototype =
h += Heights[i];
}
},
draw: function(pGraphics)
draw: function(x, y, pGraphics)
{
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
this.elements[i][j].draw(pGraphics);
this.elements[i][j].draw(x, y, pGraphics);
},
remove: function(order)
{
......@@ -866,9 +866,9 @@ CMathBase.prototype =
_width += this.dW*(this.nCol - 1);
var _center = this.getCenter(_height);
var _ascent = this.getAscent(_height);
this.size = {width: _width, height: _height, center: _center};
this.size = {width: _width, height: _height, ascent: _ascent};
},
/*RecalculateReverse: function(oMeasure)
{
......@@ -883,7 +883,7 @@ CMathBase.prototype =
this.recalculateSize();
},
getCenter: function(_height)
old_getCenter: function(_height)
{
var res = 0;
if(this.nRow > 1)
......@@ -897,6 +897,20 @@ CMathBase.prototype =
return res;
},
getAscent: function(_height)
{
var Ascent = 0;
if(this.nRow > 1)
{
Ascent = _height || this.size.height;
Ascent /=2;
}
else
for(var i=0; i< this.nCol; i++)
Ascent = (this.elements[0][i].size.ascent > Ascent) ? this.elements[0][i].size.ascent : Ascent;
return Ascent;
},
alignHor: function(pos, coeff)
{
if(pos!=-1)
......
......@@ -49,18 +49,18 @@ CBorderBox.prototype.init = function(props)
}
CBorderBox.prototype.recalculateSize = function()
{
var ss = this.elements[0][0].size;
var base = this.elements[0][0].size;
var width = ss.width;
var height = ss.height;
var center = ss.center;
var width = base.width;
var height = base.height;
var ascent = base.ascent;
this.gapBrd = this.getCtrPrp().FontSize*0.08104587131076388;
if(this.bTop)
{
height += this.gapBrd;
center += this.gapBrd;
ascent += this.gapBrd;
}
if(this.bBot)
height += this.gapBrd;
......@@ -70,19 +70,19 @@ CBorderBox.prototype.recalculateSize = function()
if(this.bRight)
width += this.gapBrd;
this.size = {width : width, height: height, center: center};
this.size = {width : width, height: height, ascent: ascent};
}
CBorderBox.prototype.draw = function(pGraphics)
CBorderBox.prototype.draw = function(x, y, pGraphics)
{
this.elements[0][0].draw(pGraphics);
this.elements[0][0].draw(x, y, pGraphics);
var penW = this.getCtrPrp().FontSize* 25.4/96 * 0.08 ;
if(this.bTop)
{
var x1 = this.pos.x,
x2 = this.pos.x + this.size.width - 25.4/96,
y1 = this.pos.y;
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - 25.4/96,
y1 = this.pos.y + y;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
......@@ -90,9 +90,9 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bBot)
{
var x1 = this.pos.x,
x2 = this.pos.x + this.size.width - 25.4/96,
y1 = this.pos.y + this.size.height - penW;
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - 25.4/96,
y1 = this.pos.y + y + this.size.height - penW;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
......@@ -100,9 +100,9 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bLeft)
{
var x1 = this.pos.x ,
y1 = this.pos.y,
y2 = this.pos.y + this.size.height - 25.4/96;
var x1 = this.pos.x + x,
y1 = this.pos.y + y,
y2 = this.pos.y + y + this.size.height - 25.4/96;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
......@@ -110,9 +110,9 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bRight)
{
var x1 = this.pos.x + this.size.width - penW ,
y1 = this.pos.y,
y2 = this.pos.y + this.size.height - 25.4/96 ;
var x1 = this.pos.x + x + this.size.width - penW ,
y1 = this.pos.y + y,
y2 = this.pos.y + y + this.size.height - 25.4/96 ;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
......@@ -121,9 +121,9 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bLDiag)
{
var pW = penW*0.8;
var x1 = this.pos.x , y1 = this.pos.y,
var x1 = this.pos.x + x , y1 = this.pos.y + y,
x2 = x1 + pW, y2 = y1,
x3 = x1 + this.size.width - 25.4/96, y3 = y1 + this.size.height - pW - 25.4/96,
x3 = x1 + x + this.size.width - 25.4/96, y3 = y1 + this.size.height - pW - 25.4/96,
x4 = x3, y4 = y3 + pW,
x5 = x4 - pW, y5 = y4,
x6 = x1, y6 = y1 + pW,
......@@ -147,10 +147,10 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bRDiag)
{
var pW = penW*0.8;
var x1 = this.pos.x + this.size.width - pW - 25.4/96, y1 = this.pos.y,
var x1 = this.pos.x + x + this.size.width - pW - 25.4/96, y1 = this.pos.y + y,
x2 = x1 + pW, y2 = y1,
x3 = x2, y3 = y2 + pW,
x4 = this.pos.x + pW, y4 = this.pos.y + this.size.height - 25.4/96,
x4 = this.pos.x + x + pW, y4 = this.pos.y + y + this.size.height - 25.4/96,
x5 = x4 - pW, y5 = y4,
x6 = x5, y6 = y5 - pW,
x7 = x1, y7 = y1;
......@@ -172,9 +172,9 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bHor)
{
var x1 = this.pos.x,
x2 = this.pos.x + this.size.width - 25.4/96,
y1 = this.pos.y + this.size.height/2 - penW/2;
var x1 = this.pos.x + x,
x2 = this.pos.x + x + this.size.width - 25.4/96,
y1 = this.pos.y + y + this.size.height/2 - penW/2;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawHorLine(0, y1, x1, x2, penW);
......@@ -182,9 +182,9 @@ CBorderBox.prototype.draw = function(pGraphics)
if(this.bVert)
{
var x1 = this.pos.x + this.size.width/2 - penW/2,
y1 = this.pos.y,
y2 = this.pos.y + this.size.height - 25.4/96;
var x1 = this.pos.x + x + this.size.width/2 - penW/2,
y1 = this.pos.y + y,
y2 = this.pos.y + y + this.size.height - 25.4/96;
pGraphics.p_color(0,0,0, 255);
pGraphics.drawVerLine(0, x1, y1, y2, penW);
......@@ -193,7 +193,7 @@ CBorderBox.prototype.draw = function(pGraphics)
}
CBorderBox.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.center};
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
var x = this.pos.x, y = this.pos.y;
......@@ -277,7 +277,6 @@ CBorderBox.prototype.getPropsForWrite = function()
return props;
}
function CBox()
{
this.kind = MATH_BOX;
......@@ -369,16 +368,16 @@ CBar.prototype.init = function(props)
this.setCharacter(props, defaultProps);
}
CBar.prototype.getCenter = function()
CBar.prototype.getAscent = function()
{
var center;
var ascent;
if(this.loc === LOCATION_TOP )
center = this.operator.size.height + this.elements[0][0].size.center;
ascent = this.operator.size.height + this.elements[0][0].size.ascent;
else if(this.loc === LOCATION_BOT )
center = this.elements[0][0].size.center;
ascent = this.elements[0][0].size.ascent;
return center;
return ascent;
}
CBar.prototype.getPropsForWrite = function()
{
......
......@@ -38,7 +38,11 @@ CDegree.prototype.init_2 = function(props, oBase)
CDegree.prototype.recalculateSize = function()
{
var Widths = this.getWidthsHeights().widths;
var Heights = [this.elements[0][0].size.height, this.elements[0][1].size.height];
var Heights = [];
Heights[0] = this.elements[0][0].size.height;
Heights[1] = this.elements[0][1].size.height;
var _center;
var middle = ((Heights[0] > Heights[1]) ? Heights[1] : Heights[0])* 2/3; /// 2/3 от высоты
......
This diff is collapsed.
This diff is collapsed.
......@@ -8,7 +8,8 @@
//api 2212: asc_docs_api.prototype.sync_TextPrFontFamilyCallBack
// возвращает название шрифта
var DIV_CENT = 0.2487852283770651;
//var DIV_CENT = 0.2487852283770651;
var DIV_CENT = 0.1;
function CMathTextPrp()
{
......@@ -153,7 +154,7 @@ CMathText.prototype =
// descent = Symbol.Descent ( = 0)
// gap = FontHeight - FontDescent - Placeholder.Height + FontDescent
old_recalculateSize: function()
old_old_recalculateSize: function()
{
/*var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.getTxtPrp());
......@@ -184,7 +185,7 @@ CMathText.prototype =
this.size = {width: _width, widthG: widthG, height: _height, center: _center, ascent: _ascent, descent: _descent};
},
Resize: function(oMeasure)
old_Resize: function(oMeasure)
{
var letter = this.getCode();
......@@ -203,6 +204,21 @@ CMathText.prototype =
this.size = {width: _width, widthG: widthG, height: _height, center: _center, ascent: _ascent, descent: _descent};
},
Resize: function(oMeasure)
{
var letter = this.getCode();
var metricsTxt = oMeasure.Measure2Code(letter);
var width = metricsTxt.Width;
var ascent = metricsTxt.Ascent;
var descent = (metricsTxt.Height - metricsTxt.Ascent);
var height = ascent + descent;
var widthG = metricsTxt.WidthG;
this.size = {width: width, widthG: widthG, height: height, ascent: ascent};
},
old_draw: function()
{
var txtPrp = this.getTxtPrp();
......@@ -251,7 +267,7 @@ CMathText.prototype =
MathControl.pGraph.FillTextCode(xx, yy , this.getCode());
},
draw: function(pGraphics)
draw: function(x, y, pGraphics)
{
/*var txtPrp = new CMathTextPrp();
txtPrp.Merge(this.getTxtPrp());
......@@ -260,8 +276,8 @@ CMathText.prototype =
//pGraphics.b_color1(0,0,0,255);
//pGraphics.SetFont(txtPrp);
var X = this.pos.x ,
Y = this.pos.y;
var X = this.pos.x + x,
Y = this.pos.y + y;
var invert = new CMatrix();
invert.sx = this.transform.sx;
......@@ -297,7 +313,7 @@ CMathText.prototype =
pGraphics.transform(sx, shy, shx, sy, 0, 0);
pGraphics.FillTextCode(xx, yy , this.getCode());
pGraphics.FillTextCode(xx, yy , this.getCode()); //на отрисовку символа отправляем положение baseLine
//pGraphics.FillTextCode(xx, yy , this.value);
},
......@@ -306,7 +322,7 @@ CMathText.prototype =
if( ! this.bJDraw) // for text
this.pos = {x : pos.x, y: pos.y };
else // for symbol only drawing
this.pos = {x: pos.x , y: pos.y + this.size.center};
this.pos = {x: pos.x , y: pos.y + this.size.ascent};
},
new_setPosition: function(pos)
{
......
......@@ -216,7 +216,7 @@ CNary.prototype.getLowerIterator = function()
}
CNary.prototype.getPropsForWrite = function()
{
var limloc = null;
var limLoc = null;
if (this.limLoc == NARY_SubSup)
limLoc = 0;
else if (this.limLoc == NARY_UndOvr)
......@@ -253,7 +253,7 @@ CNaryUnd.prototype.setDistance = function()
}
CNaryUnd.prototype.getCenter = function()
{
return this.elements[0][0].size.height + this.dH + this.elements[1][0].size.center ;
return this.elements[0][0].size.height + this.dH + this.elements[1][0].size.ascent;
}
CNaryUnd.prototype.getUpperIterator = function()
{
......@@ -282,7 +282,7 @@ CNaryOvr.prototype.setDistance = function()
}
CNaryOvr.prototype.getCenter = function()
{
return this.elements[0][0].size.center;
return this.elements[0][0].size.ascent;
}
CNaryOvr.prototype.getLowerIterator= function()
{
......@@ -314,7 +314,7 @@ CNaryUndOvr.prototype.recalculateSize = function()
this.gapTop = zetta*0.25;
this.gapBottom = zetta*0.1;
var center = this.elements[0][0].size.height + this.gapTop + this.elements[1][0].size.center;
var ascent = this.elements[0][0].size.height + this.gapTop + this.elements[1][0].size.ascent;
var width = 0, height = 0;
for(var i = 0; i < 3; i++)
......@@ -325,11 +325,11 @@ CNaryUndOvr.prototype.recalculateSize = function()
height += this.gapTop + this.gapBottom;
this.size = {width: width, height: height, center: center};
this.size = {width: width, height: height, ascent: ascent};
}
CNaryUndOvr.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y : pos.y - this.size.center};
this.pos = {x: pos.x, y : pos.y - this.size.ascent};
var x1 = pos.x + this.align(0, 0).x,
y1 = pos.y,
x2 = pos.x + this.align(1,0).x,
......@@ -406,14 +406,14 @@ function CNaryOperator(flip)
this.bFlip = (flip == -1);
this.sizeGlyph = null;
}
CNaryOperator.prototype.draw = function(pGraphics)
CNaryOperator.prototype.draw = function(x, y, pGraphics)
{
if(this.typeObj == MATH_TEXT)
this.drawTextElem(pGraphics);
this.drawTextElem(x, y, pGraphics);
else
this.drawGlyph(pGraphics);
this.drawGlyph(x, y, pGraphics);
}
CNaryOperator.prototype.drawGlyph = function(pGraphics)
CNaryOperator.prototype.drawGlyph = function(x, y,pGraphics)
{
var coord = this.getCoord();
......@@ -442,8 +442,8 @@ CNaryOperator.prototype.drawGlyph = function(pGraphics)
for(var i = 0 ; i < X.length; i++)
{
XX[i] = this.pos.x + X[i]*alpha;
YY[i] = this.pos.y + (a*Y[i]*alpha + b);
XX[i] = this.pos.x + x + X[i]*alpha;
YY[i] = this.pos.y + y + (a*Y[i]*alpha + b);
}
var intGrid = pGraphics.GetIntegerGrid();
......@@ -460,7 +460,7 @@ CNaryOperator.prototype.drawGlyph = function(pGraphics)
pGraphics.df();
pGraphics.SetIntegerGrid(intGrid);
}
CNaryOperator.prototype.drawTextElem = function(pGraphics)
CNaryOperator.prototype.drawTextElem = function(x, y, pGraphics)
{
pGraphics.b_color1(0,0,0,255);
var rPrp = new CTextPr();
......@@ -470,7 +470,7 @@ CNaryOperator.prototype.drawTextElem = function(pGraphics)
pGraphics.SetFont(rPrp);
CNaryOperator.superclass.call.draw(this, pGraphics);
CNaryOperator.superclass.call.draw(this, x, y, pGraphics);
}
CNaryOperator.prototype.IsJustDraw = function()
{
......@@ -490,9 +490,9 @@ CNaryOperator.prototype.recalculateSize = function()
var height = this.sizeGlyph.height,
width = this.sizeGlyph.width,
center = this.sizeGlyph.height/2;
ascent = this.sizeGlyph.height/2 + DIV_CENT*this.getCtrPrp().FontSize;
this.size = {height: height, width: width, center: center};
this.size = {height: height, width: width, ascent: ascent};
}
CNaryOperator.prototype.Resize = function()
{
......
......@@ -2797,7 +2797,7 @@ COperator.prototype.getProps = function(props, defaultProps)
return {loc: location, type: type, code: code};
}
COperator.prototype.draw = function(pGraphics)
COperator.prototype.draw = function(x, y, pGraphics)
{
if(this.typeOper === OPERATOR_TEXT)
{
......@@ -2813,18 +2813,17 @@ COperator.prototype.draw = function(pGraphics)
////////////////////////////////////////////////
this.operator.draw(pGraphics);
this.operator.draw(x, y, pGraphics);
}
else
{
if(this.type === OPER_SEPARATOR)
this.drawSeparator(pGraphics);
this.drawSeparator(x, y,pGraphics);
else
this.drawOperator(pGraphics);
this.drawOperator(x, y, pGraphics);
}
}
COperator.prototype.drawOperator = function(pGraphics)
COperator.prototype.drawOperator = function( absX, absY, pGraphics)
{
if(this.operator !== -1)
{
......@@ -2834,14 +2833,14 @@ COperator.prototype.drawOperator = function(pGraphics)
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.pos.x + this.coordGlyph.XX[j]);
Y.push(this.pos.y + this.coordGlyph.YY[j]);
X.push(this.pos.x + absX + this.coordGlyph.XX[j]);
Y.push(this.pos.y + absY + this.coordGlyph.YY[j]);
}
this.operator.draw(pGraphics, X, Y);
}
}
COperator.prototype.drawSeparator = function(pGraphics)
COperator.prototype.drawSeparator = function(absX, absY, pGraphics)
{
if(this.operator !== -1)
{
......@@ -2853,8 +2852,8 @@ COperator.prototype.drawSeparator = function(pGraphics)
Y = new Array();
for(var j = 0; j < lng; j++)
{
X.push(this.pos[i].x + this.coordGlyph.XX[j]);
Y.push(this.pos[i].y + this.coordGlyph.YY[j]);
X.push(this.pos[i].x + absX + this.coordGlyph.XX[j]);
Y.push(this.pos[i].y + absY + this.coordGlyph.YY[j]);
}
this.operator.draw(pGraphics, X, Y);
......@@ -2865,7 +2864,7 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
{
if(this.operator !== -1)
{
var width, height;
var width, height, ascent;
if(this.typeOper == OPERATOR_TEXT)
{
......@@ -2884,13 +2883,13 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
{
height = this.operator.size.height;
width = stretch > this.operator.size.width ? stretch : this.operator.size.width;
center = height/2;
ascent = height/2;
}
else
{
width = this.operator.size.width;
height = stretch > this.operator.size.height ? stretch : this.operator.size.height;
center = this.operator.size.height/2;
ascent = this.operator.size.height/2;
}
}
else
......@@ -2914,10 +2913,10 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
}
var betta = this.getCtrPrp().FontSize;
var center = height/2 + 0.2*betta;
ascent = height/2 + 0.2*betta;
}
this.size = { width: width, height: height, center: center};
this.size = { width: width, height: height, ascent: ascent};
}
}
COperator.prototype.setPosition = function(pos)
......@@ -3230,7 +3229,7 @@ CDelimiter.prototype.old_recalculateSize = function()
CDelimiter.prototype.Resize = function(oMeasure)
{
var height = 0,
width = 0, center = 0;
width = 0;
var ascent = 0,
descent = 0;
......@@ -3256,8 +3255,8 @@ CDelimiter.prototype.Resize = function(oMeasure)
{
var content = this.elements[0][j].size;
width += content.width;
ascent = content.center > ascent ? content.center : ascent;
descent = content.height - content.center > descent ? content.height - content.center: descent;
ascent = content.ascent > ascent ? content.ascent : ascent;
descent = content.height - content.ascent > descent ? content.height - content.ascent: descent;
}
maxH = ascent > descent ? ascent : descent;
......@@ -3268,20 +3267,17 @@ CDelimiter.prototype.Resize = function(oMeasure)
if(maxH < plH)
{
height = ascent + descent;
center = ascent;
}
else
{
div = ascent - plH;
height = ascent + descent + div;
center = ascent;
}
}
else
{
height = 2*maxH;
center = height/2;
ascent = height/2;
}
}
else
......@@ -3290,12 +3286,11 @@ CDelimiter.prototype.Resize = function(oMeasure)
{
var content = this.elements[0][j].size;
width += content.width;
ascent = content.center > ascent ? content.center : ascent;
descent = content.height - content.center > descent ? content.height - content.center: descent;
ascent = content.ascent > ascent ? content.ascent : ascent;
descent = content.height - content.ascent > descent ? content.height - content.ascent: descent;
}
height = ascent + descent;
center = ascent;
}
this.begOper.fixSize(oMeasure, height);
......@@ -3303,7 +3298,7 @@ CDelimiter.prototype.Resize = function(oMeasure)
if(height < this.begOper.size.height)
{
center = this.begOper.size.height - H2;
ascent = this.begOper.size.height - H2;
height = this.begOper.size.height;
//center = this.begOper.size.center;
......@@ -3314,16 +3309,17 @@ CDelimiter.prototype.Resize = function(oMeasure)
if(height < this.endOper.size.height)
{
//center += (height - this.endOper.size.height)/2;
center = this.endOper.size.height - H2;
ascent = this.endOper.size.height - H2;
height = this.endOper.size.height;
//center = this.endOper.size.center;
}
this.sepOper.fixSize(oMeasure, height);
width += (this.nCol - 1)*this.sepOper.size.width;
if(height < this.endOper.size.height)
if(height < this.sepOper.size.height)
{
//center += (height - this.sepOper.size.height)/2;
ascent = this.sepOper.size.height - H2;
height = this.sepOper.size.height;
//center = this.sepOper.size.center;
}
......@@ -3368,7 +3364,7 @@ CDelimiter.prototype.Resize = function(oMeasure)
center = (center < this.sepOper.size.center) ? this.sepOper.size.center : center;
}*/
this.size = {width: width, height: height, center: center};
this.size = {width: width, height: height, ascent: ascent};
}
CDelimiter.prototype.alignOperator = function(height)
......@@ -3399,7 +3395,7 @@ CDelimiter.prototype.alignOperator = function(height)
}
CDelimiter.prototype.setPosition = function(position)
{
this.pos = {x: position.x, y: position.y - this.size.center};
this.pos = {x: position.x, y: position.y - this.size.ascent};
var x = this.pos.x,
y = this.pos.y;
......@@ -3494,20 +3490,20 @@ CDelimiter.prototype.findDisposition = function(pos)
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
CDelimiter.prototype.draw = function(pGraphics)
CDelimiter.prototype.draw = function(x, y, pGraphics)
{
this.begOper.draw(pGraphics);
this.sepOper.draw(pGraphics);
this.endOper.draw(pGraphics);
this.begOper.draw(x, y, pGraphics);
this.sepOper.draw(x, y, pGraphics);
this.endOper.draw(x, y, pGraphics);
for(var j = 0; j < this.nCol; j++)
this.elements[0][j].draw(pGraphics);
this.elements[0][j].draw(x, y,pGraphics);
}
CDelimiter.prototype.align = function(element)
{
var align = 0;
if(!element.IsJustDraw())
align = this.size.center - element.size.center;
align = this.size.ascent - element.size.ascent;
else
align = (this.size.height - element.size.height)/2;
......
......@@ -7,7 +7,7 @@ function CSignRadical()
this.sizeTick = null;
this.widthSlash = null;
}
CSignRadical.prototype.draw = function(pGraphics)
CSignRadical.prototype.draw = function(x, y, pGraphics)
{
var txtPrp = this.Parent.getCtrPrp();
//var txtPrp = this.Parent.getTxtPrp();
......@@ -15,10 +15,10 @@ CSignRadical.prototype.draw = function(pGraphics)
var plH = 9.877777777777776 * txtPrp.FontSize /36;
var x1 = this.pos.x,
var x1 = this.pos.x + x,
x2 = x1 + 0.25*this.widthSlash;
var y2 = this.pos.y + this.size.height -this.sizeTick.height,
var y2 = this.pos.y + y + this.size.height -this.sizeTick.height,
y1 = y2 + 0.11*this.widthSlash;
......@@ -28,6 +28,8 @@ CSignRadical.prototype.draw = function(pGraphics)
var x3 = x2 - tX,
y3 = y2 - tY;
var x4;
/*var minHeight = plH * 1.1304931640625,
maxHeight = plH * 7.029296875;
......@@ -44,13 +46,13 @@ CSignRadical.prototype.draw = function(pGraphics)
else
x4 = x1 + this.widthSlash;
var y4 = this.pos.y + this.size.height - penW;
var y4 = this.pos.y + y + this.size.height - penW;
var x5 = x1 + this.widthSlash,
x6 = this.pos.x + this.size.width;
x6 = this.pos.x + x + this.size.width;
var y5 = this.pos.y,
y6 = this.pos.y;
var y5 = this.pos.y + y,
y6 = this.pos.y + y;
pGraphics.p_width(penW*0.8*1000);
......@@ -223,9 +225,10 @@ CRadical.prototype.recalculateSize = function()
var height = sign.height,
width = sign.width,
center = (height - arg.height)*0.6 + arg.center;
ascent = height - (arg.height - arg.ascent);
//center = (height - arg.height)*0.6 + arg.center;
this.size = {width: width, height: height, center: center};
this.size = {width: width, height: height, ascent: ascent};
}
else if(this.type == DEGREE_RADICAL)
{
......@@ -249,29 +252,33 @@ CRadical.prototype.recalculateSize = function()
var h1 = degr.height + this.gap + hTick,
h2 = sign.height;
var height, center;
var height, ascent;
if(h1 > h2)
{
height = h1;
center = h1 - h2 + (sign.height - base.height)*0.6 + base.center;
ascent = height - (base.height - base.ascent);
//center = h1 - h2 + (sign.height - base.height)*0.6 + base.center;
}
else
{
height = h2;
center = (sign.height - base.height)*0.6 + base.center;
ascent = height - (base.height - base.ascent);
//center = (sign.height - base.height)*0.6 + base.center;
}
this.size = {width: width, height: height, center: center};
this.size = {width: width, height: height, ascent: ascent};
}
}
CRadical.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
if(this.type == SQUARE_RADICAL)
{
this.pos = {x: pos.x, y: pos.y - this.size.center};
this.gapLeft = this.size.width - this.elements[0][0].size.width;
this.gapTop = this.size.center - this.elements[0][0].size.center;
this.gapTop = this.size.ascent - this.elements[0][0].size.ascent;
var x = this.pos.x + this.gapLeft,
y = this.pos.y + this.gapTop;
......@@ -281,8 +288,6 @@ CRadical.prototype.setPosition = function(pos)
}
else if(this.type == DEGREE_RADICAL)
{
this.pos = {x: pos.x, y: pos.y - this.size.center};
var degr = this.elements[0][0].size,
base = this.elements[0][1].size,
sign = this.signRadical.size;
......@@ -301,7 +306,7 @@ CRadical.prototype.setPosition = function(pos)
this.signRadical.setPosition({x: x2, y: y2});
var x3 = this.pos.x + this.size.width - base.width,
y3 = this.pos.y + this.size.center - base.center;
y3 = this.pos.y + this.size.ascent - base.ascent;
this.elements[0][1].setPosition({x: x3, y: y3});
}
......@@ -390,7 +395,7 @@ CRadical.prototype.findDisposition = function(mCoord)
posCurs.y = 1;
mouseCoord.x = mCoord.x - (this.size.width - base.width);
var topBase = this.size.center - base.center;
var topBase = this.size.ascent - base.ascent;
if(mCoord.y < topBase)
{
......@@ -411,10 +416,10 @@ CRadical.prototype.findDisposition = function(mCoord)
return disposition;
}
CRadical.prototype.draw = function(pGraphics)
CRadical.prototype.draw = function(x, y, pGraphics)
{
this.signRadical.draw(pGraphics);
CRadical.superclass.draw.call(this, pGraphics);
this.signRadical.draw(x, y, pGraphics);
CRadical.superclass.draw.call(this, x, y, pGraphics);
}
CRadical.prototype.getBase = function()
{
......
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