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

Переделан расчет высоты радикала с учетом инлайновости формулы

Bug #31898

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@68781 954022d7-b5bf-4e40-9824-e11837661b57
parent e6177d07
...@@ -47,7 +47,8 @@ CSignRadical.prototype.draw = function(x, y, pGraphics, PDSE) ...@@ -47,7 +47,8 @@ CSignRadical.prototype.draw = function(x, y, pGraphics, PDSE)
var sin2 = 0.876, var sin2 = 0.876,
tg = 1.848; tg = 1.848;
var yy4 = this.pos.y + y + Height;
var yy4 = this.pos.y + y + Height + 0.35;
var xx4; var xx4;
var shift = penW1*0.2336; var shift = penW1*0.2336;
...@@ -162,52 +163,50 @@ CSignRadical.prototype.draw = function(x, y, pGraphics, PDSE) ...@@ -162,52 +163,50 @@ CSignRadical.prototype.draw = function(x, y, pGraphics, PDSE)
PDSE.Graphics._s(); PDSE.Graphics._s();
}; };
CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg) CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg, bInline)
{ {
var txtPrp = this.Parent.Get_CompiledCtrPrp(); var height = 0;
var FontSize = this.Parent.Get_CompiledCtrPrp().FontSize;
var height, width; var measureH = 0.27438 * FontSize;
var plH = 9.877777777777776 * txtPrp.FontSize/36;
this.gapArg = txtPrp.FontSize*g_dKoef_pt_to_mm*0.077108; /// расстояние до аргумента
this.gapSign = txtPrp.FontSize*g_dKoef_pt_to_mm*0.094492; /// расстояние до значка радикала
var heightArg = sizeArg.height + this.gapArg, var H1;
widthArg = sizeArg.width;
var H0 = measureH*1.07,
H2 = measureH*2.8,
H3 = measureH*4.08,
H4 = measureH*5.7,
H5 = measureH*7.15;
////////// Height /////////// if(bInline)
{
this.gapArg = measureH*0.01; /// расстояние до аргумента
this.gapSign = 0; /// расстояние до значка радикала
/*var H0 = plH*1.2, H1 = measureH*1.47;
H1 = plH*1.50732421875, }
H2 = plH*2.760986328125, else
H3 = plH*4.217578125, {
H4 = plH*5.52197265625, this.gapArg = measureH*0.0991; /// расстояние до аргумента
H5 = plH*7.029296875;*/ this.gapSign = measureH*0.1215; /// расстояние до значка радикала
var H0 = plH*1.07, H1 = measureH*1.6235;
//H1 = plH*1.50732421875, }
H1 = plH*1.6234788833214036,
H2 = plH*2.8,
H3 = plH*4.08,
H4 = plH*5.7,
H5 = plH*7.15;
var heightArg = sizeArg.height + this.gapArg,
widthArg = sizeArg.width;
this.measure.bHigh = false; this.measure.bHigh = false;
var bDescentArg = sizeArg.height - sizeArg.ascent > 0.4*txtPrp.FontSize/11; // т.к. у нас почему-то для строчных букв "а" и тп descent не нулевой, см метрики в mathText.js var bDescentArg = sizeArg.height - sizeArg.ascent > 0.036*FontSize; // т.к. у нас почему-то для строчных букв "а" и тп descent не нулевой, см метрики в mathText.js
if(heightArg < H0 && !bDescentArg) if(heightArg < H0 && !bDescentArg)
height = H0*1.12; height = H0;
//height = H0*1.058;
else if( heightArg < H1) else if( heightArg < H1)
//height = H1*0.9284532335069441;
height = H1; height = H1;
else if( heightArg < H2 ) else if( heightArg < H2 )
height = H2; height = H2;
else if( heightArg < H3 ) else if( heightArg < H3 )
height = H3*1.04; height = H3;
else if( heightArg < H4 ) else if( heightArg < H4 )
height = H4; height = H4;
else if( heightArg < H5 ) else if( heightArg < H5 )
...@@ -217,17 +216,16 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg) ...@@ -217,17 +216,16 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg)
height = heightArg; height = heightArg;
this.measure.bHigh = true; this.measure.bHigh = true;
} }
//////////////////////////////////// ////////////////////////////////////
////////// Size of tick ////////// ////////// Size of tick //////////
var minHgtRad = plH * 1.130493164, var minHgtRad = 1.13*measureH,
maxHgtRad = plH * 7.029296875; maxHgtRad = 7.03*measureH;
var minHgtTick = plH*0.6, var minHgtTick = 0.6*measureH,
maxHgtTick = 1.2*plH; maxHgtTick = 1.2*measureH;
var heightTick, widthSlash, var heightTick, widthSlash,
gapLeft; gapLeft;
...@@ -235,46 +233,43 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg) ...@@ -235,46 +233,43 @@ CSignRadical.prototype.recalculateSize = function(oMeasure, sizeArg)
if ( heightArg > maxHgtRad ) if ( heightArg > maxHgtRad )
{ {
heightTick = maxHgtTick; heightTick = maxHgtTick;
widthSlash = plH * 0.67; widthSlash = 0.67*measureH;
gapLeft = 0.2*plH; gapLeft = 0.2*measureH;
} }
else else
{ {
var H; var zetta;
if(heightArg < H1) if(height < H1)
{ zetta = 0.75;
H = H1; else if(heightArg < H1)
var zetta = height < H1 ? 0.75 : 0.82; zetta = 0.82;
widthSlash = plH *zetta;
}
else else
{ zetta = 0.868;
H = height;
widthSlash = plH * 0.8681086138556986; widthSlash = measureH *zetta;
} var H = heightArg < H1 ? H1 : height;
var alpha = (H - minHgtRad)/(2*maxHgtRad); var alpha = (H - minHgtRad)/(2*maxHgtRad);
heightTick = minHgtTick*(1 + alpha); heightTick = minHgtTick*(1 + alpha);
gapLeft = 0.12683105468750022* plH; gapLeft = 0.127* measureH;
} }
this.measure.widthSlash = widthSlash; this.measure.widthSlash = widthSlash;
this.measure.heightTick = heightTick; this.measure.heightTick = heightTick;
this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize; this.measure.widthTick = 0.13*FontSize;
////////////////////////////// //////////////////////////////
////////// WidthБ Height ////////// ////////// Width, Height //////////
width = widthSlash + gapLeft + widthArg;
height += this.gapSign;
//////////////////////////////
this.size.height = height; this.size.height = height + this.gapSign;
this.size.width = width; this.size.width = widthSlash + gapLeft + widthArg;
//////////////////////////////
}; };
CSignRadical.prototype.setPosition = function(pos) CSignRadical.prototype.setPosition = function(pos)
{ {
...@@ -488,7 +483,7 @@ CRadical.prototype.recalculateSize = function(oMeasure) ...@@ -488,7 +483,7 @@ CRadical.prototype.recalculateSize = function(oMeasure)
var shTop, var shTop,
height, width, ascent; height, width, ascent;
this.signRadical.recalculateSize(oMeasure, this.RealBase.size); this.signRadical.recalculateSize(oMeasure, this.RealBase.size, this.ParaMath.Is_Inline());
var txtPrp = this.Get_CompiledCtrPrp(); var txtPrp = this.Get_CompiledCtrPrp();
var sign = this.signRadical.size, var sign = this.signRadical.size,
......
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