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

1. Поправила баг с высотой для delimiters для случая текстового оператора

2. Поправила ascent (центр) для стрелок в качестве оператора, теперь линии стрелок для положения над контентом и под контентом совпадают

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54999 954022d7-b5bf-4e40-9824-e11837661b57
parent 879cdc55
...@@ -5281,6 +5281,28 @@ CMathContent.prototype = ...@@ -5281,6 +5281,28 @@ CMathContent.prototype =
{ {
var bHidePlh = this.plhHide && this.IsPlaceholder(); var bHidePlh = this.plhHide && this.IsPlaceholder();
///// test //////
/*if(!this.bRoot)
{
var xx = x + this.pos.x,
yy = y + this.pos.y,
w = this.size.width,
h = this.size.height;
pGraphics.p_width(1000);
pGraphics.b_color1(0,0,250, 255);
pGraphics._s();
pGraphics._m(xx, yy);
pGraphics._l(xx + w, yy);
pGraphics._l(xx + w, yy + h);
pGraphics._l(xx, yy + h);
pGraphics._l(xx, yy);
pGraphics.df();
}*/
//////////////////////
if( !bHidePlh ) if( !bHidePlh )
{ {
for(var i=1; i < this.content.length;i++) for(var i=1; i < this.content.length;i++)
......
...@@ -226,6 +226,43 @@ CGlyphOperator.prototype.getCoordinateGlyph = function() ...@@ -226,6 +226,43 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
// A*x + B*y + C = 0 // A*x + B*y + C = 0
var bLine = this.Parent.typeOper == DELIMITER_LINE || this.Parent.typeOper == DELIMITER_DOUBLE_LINE, // если оператор линия, то размещаем оператор по середине
bArrow = this.Parent.typeOper == ARROW_LEFT || this.Parent.typeOper == ARROW_RIGHT || this.Parent.typeOper == ARROW_LR,
bDoubleArrow = this.Parent.typeOper == DOUBLE_LEFT_ARROW || this.Parent.typeOper == DOUBLE_RIGHT_ARROW || this.Parent.typeOper == DOUBLE_ARROW_LR;
if(bLine)
{
if(this.loc == LOCATION_TOP)
{
a1 = 1; b1 = 0; c1 = 0;
a2 = 0; b2 = 1; c2 = (H - glH)/2;
}
else if(this.loc == LOCATION_BOT)
{
a1 = 1; b1 = 0; c1 = 0;
a2 = 0; b2 = 1; c2 = (H - glH)/2;
}
else if(this.loc == LOCATION_LEFT)
{
a1 = 0; b1 = 1; c1 = (W - glW)/2;
a2 = 1; b2 = 0; c2 = 0;
}
else if(this.loc == LOCATION_RIGHT)
{
a1 = 0; b1 = 1; c1 = (W - glW)/2;
a2 = 1; b2 = 0; c2 = 0;
}
else if(this.loc == LOCATION_SEP)
{
a1 = 0; b1 = 1; c1 = (W - glW)/2;
a2 = 1; b2 = 0; c2 = 0;
}
}
else
{
if(this.loc == LOCATION_TOP) if(this.loc == LOCATION_TOP)
{ {
a1 = 1; b1 = 0; c1 = 0; a1 = 1; b1 = 0; c1 = 0;
...@@ -235,6 +272,7 @@ CGlyphOperator.prototype.getCoordinateGlyph = function() ...@@ -235,6 +272,7 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
{ {
a1 = 1; b1 = 0; c1 = 0; a1 = 1; b1 = 0; c1 = 0;
a2 = 0; b2 = 1; c2 = H - glH; a2 = 0; b2 = 1; c2 = H - glH;
} }
else if(this.loc == LOCATION_LEFT) else if(this.loc == LOCATION_LEFT)
{ {
...@@ -243,6 +281,7 @@ CGlyphOperator.prototype.getCoordinateGlyph = function() ...@@ -243,6 +281,7 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
} }
else if(this.loc == LOCATION_RIGHT) else if(this.loc == LOCATION_RIGHT)
{ {
a1 = 0; b1 = 1; c1 = W - glW; a1 = 0; b1 = 1; c1 = W - glW;
a2 = 1; b2 = 0; c2 = 0; a2 = 1; b2 = 0; c2 = 0;
} }
...@@ -251,6 +290,50 @@ CGlyphOperator.prototype.getCoordinateGlyph = function() ...@@ -251,6 +290,50 @@ CGlyphOperator.prototype.getCoordinateGlyph = function()
a1 = 0; b1 = 1; c1 = 0; a1 = 0; b1 = 1; c1 = 0;
a2 = 1; b2 = 0; c2 = 0; a2 = 1; b2 = 0; c2 = 0;
} }
}
/*if(this.loc == LOCATION_TOP)
{
a1 = 1; b1 = 0; c1 = 0;
a2 = 0; b2 = 1; c2 = 0;
}
else if(this.loc == LOCATION_BOT)
{
a1 = 1; b1 = 0; c1 = 0;
if(bLine)
{
a2 = 0; b2 = 1; c2 = (H - glH)/2;
}
else
{
a2 = 0; b2 = 1; c2 = H - glH;
}
}
else if(this.loc == LOCATION_LEFT)
{
a1 = 0; b1 = 1; c1 = 0;
a2 = 1; b2 = 0; c2 = 0;
}
else if(this.loc == LOCATION_RIGHT)
{
if(bLine)
{
a1 = 0; b1 = 1; c1 = (W - glW)/2;
}
else
{
a1 = 0; b1 = 1; c1 = W - glW;
}
a2 = 1; b2 = 0; c2 = 0;
}
else if(this.loc == LOCATION_SEP)
{
a1 = 0; b1 = 1; c1 = 0;
a2 = 1; b2 = 0; c2 = 0;
}*/
/*var shW = 0, /*var shW = 0,
...@@ -1258,7 +1341,8 @@ COperatorLine.prototype.calcCoord = function(stretch) ...@@ -1258,7 +1341,8 @@ COperatorLine.prototype.calcCoord = function(stretch)
var XX = new Array(), var XX = new Array(),
YY = new Array(); YY = new Array();
var shY = 2*Y[1]*alpha; //var shY = 2*Y[1]*alpha;
var shY = 0;
for(var i = 0; i < X.length; i++) for(var i = 0; i < X.length; i++)
{ {
...@@ -1428,7 +1512,8 @@ COperatorDoubleLine.prototype.calcCoord = function(stretch) ...@@ -1428,7 +1512,8 @@ COperatorDoubleLine.prototype.calcCoord = function(stretch)
var XX = new Array(), var XX = new Array(),
YY = new Array(); YY = new Array();
var shY = 1.5*Y[1]*alpha; //var shY = 1.5*Y[1]*alpha;
var shY = 0;
for(var i = 0; i < X.length; i++) for(var i = 0; i < X.length; i++)
{ {
...@@ -1849,7 +1934,7 @@ CCombiningArrow.prototype.calcSize = function() ...@@ -1849,7 +1934,7 @@ CCombiningArrow.prototype.calcSize = function()
{ {
var betta = this.getCtrPrp().FontSize/36; var betta = this.getCtrPrp().FontSize/36;
var height = 3.88*betta; var height = 3.9*betta;
var width = 4.938*betta; var width = 4.938*betta;
return {width: width, height: height}; return {width: width, height: height};
...@@ -2978,6 +3063,10 @@ COperator.prototype.fixSize = function(oMeasure, stretch) ...@@ -2978,6 +3063,10 @@ COperator.prototype.fixSize = function(oMeasure, stretch)
var mgCtrPrp = this.Parent.mergeCtrTPrp(); var mgCtrPrp = this.Parent.mergeCtrTPrp();
var shCenter = this.Parent.Composition.GetShiftCenter(oMeasure, mgCtrPrp); var shCenter = this.Parent.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
if(this.operator.loc == 0 || this.operator.loc == 1) // horizontal
ascent = dims.Height/2;
else // vertical
ascent = height/2 + shCenter; ascent = height/2 + shCenter;
this.size = { width: width, height: height, ascent: ascent}; this.size = { width: width, height: height, ascent: ascent};
...@@ -3323,10 +3412,14 @@ CDelimiter.prototype.Resize = function(oMeasure) ...@@ -3323,10 +3412,14 @@ CDelimiter.prototype.Resize = function(oMeasure)
var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp); var shCenter = this.Composition.GetShiftCenter(oMeasure, mgCtrPrp);
var maxAD = ascentG - shCenter > descentG + shCenter ? ascentG - shCenter: descentG + shCenter; var maxAD = ascentG - shCenter > descentG + shCenter ? ascentG - shCenter: descentG + shCenter;
var plH = 9.877777777777776 * mgCtrPrp.FontSize/36;
var bTextContent = ascentG < plH || descentG < plH; // для текста операторы в случае центрирования не увеличиваем
var bCentered = this.shape == DELIMITER_SHAPE_CENTERED, var bCentered = this.shape == DELIMITER_SHAPE_CENTERED,
b2Max = bCentered && (2*maxAD - heightG > 0.001); b2Max = bCentered && (2*maxAD - heightG > 0.001);
var heightStretch = b2Max ? 2*maxAD : ascentG + descentG;
var heightStretch = b2Max && !bTextContent ? 2*maxAD : ascentG + descentG;
this.begOper.fixSize(oMeasure, heightStretch); this.begOper.fixSize(oMeasure, heightStretch);
this.endOper.fixSize(oMeasure, heightStretch); this.endOper.fixSize(oMeasure, heightStretch);
...@@ -3350,7 +3443,6 @@ CDelimiter.prototype.Resize = function(oMeasure) ...@@ -3350,7 +3443,6 @@ CDelimiter.prototype.Resize = function(oMeasure)
if(this.shape == DELIMITER_SHAPE_CENTERED) if(this.shape == DELIMITER_SHAPE_CENTERED)
{ {
var deltaHeight = heightG - maxDimOper.height; var deltaHeight = heightG - maxDimOper.height;
if(deltaHeight < 0) if(deltaHeight < 0)
deltaHeight = -deltaHeight; deltaHeight = -deltaHeight;
...@@ -3364,11 +3456,12 @@ CDelimiter.prototype.Resize = function(oMeasure) ...@@ -3364,11 +3456,12 @@ CDelimiter.prototype.Resize = function(oMeasure)
var bLHeight = deltaHeight < 0.001, var bLHeight = deltaHeight < 0.001,
bLMaxAD = deltaMaxAD > 0.001, bLMaxAD = deltaMaxAD > 0.001,
bLMinAD = deltaMinAD > 0.001, bLMinAD = deltaMinAD > 0.001,
bTextContent = deltaMinAD < -0.001; bLText = deltaMinAD < - 0.001;
var bEqualOper = bLHeight, var bEqualOper = bLHeight,
bMiddleOper = bLMaxAD && !bLMinAD, bMiddleOper = bLMaxAD && !bLMinAD,
bLittleOper = bLMinAD; bLittleOper = bLMinAD,
bText = bLText;
if(bEqualOper) if(bEqualOper)
{ {
...@@ -3380,9 +3473,10 @@ CDelimiter.prototype.Resize = function(oMeasure) ...@@ -3380,9 +3473,10 @@ CDelimiter.prototype.Resize = function(oMeasure)
height = maxDimOper.height/2 + maxAD; height = maxDimOper.height/2 + maxAD;
ascent = ascentG > maxDimOper.ascent? ascentG : maxDimOper.ascent; ascent = ascentG > maxDimOper.ascent? ascentG : maxDimOper.ascent;
} }
else if(bTextContent) else if(bText)
{ {
ascent = maxDimOper.ascent; //ascent = maxDimOper.ascent;
ascent = ascentG > maxDimOper.ascent ? ascentG : maxDimOper.ascent;
height = maxDimOper.height; height = maxDimOper.height;
} }
else else
...@@ -3716,7 +3810,6 @@ CDelimiter.prototype.align = function(element) ...@@ -3716,7 +3810,6 @@ CDelimiter.prototype.align = function(element)
else else
align = (this.size.height - element.size.height)/2; align = (this.size.height - element.size.height)/2;
//align = (this.size.height - element.size.height)/2;
return align; return align;
} }
...@@ -3773,7 +3866,7 @@ CCharacter.prototype.Resize = function(oMeasure) ...@@ -3773,7 +3866,7 @@ CCharacter.prototype.Resize = function(oMeasure)
var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width, var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width,
height = base.size.height + this.operator.size.height, height = base.size.height + this.operator.size.height,
ascent = this.getAscent(); ascent = this.getAscent(oMeasure);
this.size = {height: height, width: width, ascent: ascent}; this.size = {height: height, width: width, ascent: ascent};
} }
...@@ -3921,20 +4014,23 @@ CGroupCharacter.prototype.init = function(props) ...@@ -3921,20 +4014,23 @@ CGroupCharacter.prototype.init = function(props)
/*if(this.operator.IsArrow()) /*if(this.operator.IsArrow())
this.setReduct(DEGR_REDUCT);*/ this.setReduct(DEGR_REDUCT);*/
} }
CGroupCharacter.prototype.getAscent = function() CGroupCharacter.prototype.getAscent = function(oMeasure)
{ {
var ascent; var ascent;
var shCent = DIV_CENT*this.getCtrPrp().FontSize; //var shCent = DIV_CENT*this.getCtrPrp().FontSize;
var ctrPrp = this.getCtrPrp();
var shCent = this.Composition.GetShiftCenter(oMeasure, ctrPrp);
if(this.vertJust === VJUST_TOP && this.loc === LOCATION_TOP) if(this.vertJust === VJUST_TOP && this.loc === LOCATION_TOP)
ascent = this.operator.size.height/2 + shCent; ascent = this.operator.size.ascent + shCent;
else if(this.vertJust === VJUST_BOT && this.loc === LOCATION_TOP ) else if(this.vertJust === VJUST_BOT && this.loc === LOCATION_TOP )
ascent = this.operator.size.height + this.elements[0][0].size.ascent; ascent = this.operator.size.height + this.elements[0][0].size.ascent;
else if(this.vertJust === VJUST_TOP && this.loc === LOCATION_BOT ) else if(this.vertJust === VJUST_TOP && this.loc === LOCATION_BOT )
ascent = this.elements[0][0].size.ascent; ascent = this.elements[0][0].size.ascent;
else if(this.vertJust === VJUST_BOT && this.loc === LOCATION_BOT ) else if(this.vertJust === VJUST_BOT && this.loc === LOCATION_BOT )
ascent = this.operator.size.height/2 + shCent + this.elements[0][0].size.height; ascent = this.elements[0][0].size.height + shCent + this.operator.size.height - this.operator.size.ascent;
//ascent = this.operator.size.height/2 + shCent + this.elements[0][0].size.height;
return ascent; return 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