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

Квадратный корень: подогнала высоту изменения радикала в зависимости от аргумента

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@54885 954022d7-b5bf-4e40-9824-e11837661b57
parent 5725fff2
...@@ -5176,7 +5176,9 @@ CMathContent.prototype = ...@@ -5176,7 +5176,9 @@ CMathContent.prototype =
}, },
getGapsInside: function() // учитываем gaps внутренних объектов getGapsInside: function() // учитываем gaps внутренних объектов
{ {
var bFirstComp = this.content[1].value.typeObj == MATH_COMP, var typeFirst = this.content.length > 1 ? this.content[1].value.typeObj : null;
var bFirstComp = typeFirst == MATH_COMP,
bLastComp = false; bLastComp = false;
var posLComp = -1; var posLComp = -1;
...@@ -7903,6 +7905,14 @@ CMathComposition.prototype = ...@@ -7903,6 +7905,14 @@ CMathComposition.prototype =
// position вычислить естественно до того, как придет Draw, чтобы не пришлось пересчитывать при изменении в тексте документа // position вычислить естественно до того, как придет Draw, чтобы не пришлось пересчитывать при изменении в тексте документа
Draw: function(x, y, pGraphics) Draw: function(x, y, pGraphics)
{ {
//// test
this.RecalculateComposition(g_oTextMeasurer);
////
this.absPos = {x: x, y: y - this.Root.size.ascent}; this.absPos = {x: x, y: y - this.Root.size.ascent};
if(this.Root.content.length > 1) if(this.Root.content.length > 1)
...@@ -8091,6 +8101,15 @@ CMathComposition.prototype = ...@@ -8091,6 +8101,15 @@ CMathComposition.prototype =
}, },
RecalculateComposition: function(oMeasure, TextPr) // textPrp в тестовом режиме, просто отрисуем с ними формулу RecalculateComposition: function(oMeasure, TextPr) // textPrp в тестовом режиме, просто отрисуем с ними формулу
{ {
/*console.log("SIGN_GAP: " + SIGN_GAP);
console.log("RADICAL_GAP: " + RADICAL_GAP);
console.log("RADICAL_H0: " + RADICAL_H0);
console.log("RADICAL_H1: " + RADICAL_H1);
console.log("RADICAL_H2: " + RADICAL_H2);
console.log("RADICAL_H3: " + RADICAL_H3);
console.log("RADICAL_H4: " + RADICAL_H4);
console.log("RADICAL_H5: " + RADICAL_H5);*/
this.Resize(oMeasure); // пересчитываем всю формулу this.Resize(oMeasure); // пересчитываем всю формулу
var width = this.Root.size.width, var width = this.Root.size.width,
......
/*var SIGN_GAP = 0;
var RADICAL_GAP = 0.2513;
var RADICAL_H4 = 1.1715;
var RADICAL_H0 = 0;
var RADICAL_H1 = 0;
var RADICAL_H2 = 0;
var RADICAL_H3 = 0;
var RADICAL_H5 = 0;*/
/*var SIGN_GAP = 0.05;
var RADICAL_GAP = 0.1216;
var RADICAL_H4 = 1.2393;
var RADICAL_H0 = 0;
var RADICAL_H1 = 1.1588;
var RADICAL_H2 = 1.1673;
var RADICAL_H3 = 1.0232;
var RADICAL_H5 = 0;*/
//var SIGN_GAP = 0.05;
//var RADICAL_GAP = 0.1216;
//var GAP_TOP = 0.05;
//var SIGN_GAP = 0.1216;
//var GAP_TOP = 0.01822;
var GAP_TOP = 0.094492;
var SIGN_GAP = 0.15338;
/*var RADICAL_H0 = 0;
var RADICAL_H1 = 0.1589;
var RADICAL_H2 = 0.1674;
var RADICAL_H3 = 0.038;
var RADICAL_H4 = 0.303;
var RADICAL_H5 = 0.2394;*/
var RADICAL_H0 = 1.2;
var RADICAL_H1 = 1.50732421875;
var RADICAL_H2 = 2.8;
var RADICAL_H3 = 4.08;
var RADICAL_H4 = 5.7;
var RADICAL_H5 = 7.15;
/// Gap = 0.2513
function CSignRadical() function CSignRadical()
{ {
this.Parent = null; this.Parent = null;
this.pos = null; this.pos = null;
this.size = null; this.size = null;
this.gapTop = 0;
this.gapSign = 0;
this.measure = this.measure =
{ {
...@@ -16,18 +63,113 @@ function CSignRadical() ...@@ -16,18 +63,113 @@ function CSignRadical()
//this.sizeTick = null; //this.sizeTick = null;
//this.widthSlash = null; //this.widthSlash = null;
} }
CSignRadical.prototype.new_draw = function(x, y, pGraphics)
{
var txtPrp = this.Parent.getCtrPrp();
//var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
y += this.gapTop + penW/2; // смещаем, для отрисовки верхней линии радикала
var x1 = this.pos.x + x,
x2 = x1 + 0.048*txtPrp.FontSize;
var Height = this.size.height - this.gapTop;
var y2 = this.pos.y + y + Height - this.measure.heightTick,
y1 = y2 + 0.0242*txtPrp.FontSize;
var tg = 0.048/0.0242;
var tX = tg*0.85*penW,
tY = 0.92*penW / tg;
var x3 = x2,
y3 = y2 - tY;
//var plH = 9.877777777777776 * txtPrp.FontSize /36;
var sin = 0.876,
cos = 0.474;
var y4 = this.pos.y + y + Height - penW;
var y5 = y4 + penW/2*cos;
// 0.048*txtPrp.FontSize + (- penW + this.measure.heightTick + 0.92*penW / tg )/ tg
var x4, x5;
if( !this.measure.bHigh )
{
x4 = x3 + (y4-y3)/tg;
x5 = x4 + penW/2*sin;
}
else
{
x4 = x1 + this.measure.widthSlash - penW/3*sin;
x5 = x1 + this.measure.widthSlash;
}
var x6 = x1 + this.measure.widthSlash,
x7 = this.pos.x + x + this.size.width;
var y6 = this.pos.y + y,
y7 = this.pos.y + y;
pGraphics.p_width(penW*0.8*1000);
pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(x1, y1);
pGraphics._l(x2, y2);
pGraphics.ds();
pGraphics.p_width(1.7*penW*1000);
pGraphics._s();
pGraphics._m(x3, y3);
pGraphics._l(x4, y4);
pGraphics.ds();
pGraphics.p_width(penW*1000);
pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255);
pGraphics.p_width(penW*1000);
pGraphics._s();
pGraphics._m(x5, y5);
pGraphics._l(x6, y6);
pGraphics._l(x7, y7);
pGraphics.ds();
pGraphics.p_color(0,0,0, 255);
pGraphics.b_color1(0,0,0, 255);
pGraphics._s();
pGraphics._m(x4 - penW*0.6*sin, y4 - penW/5);
pGraphics._l(x5 + penW/3*sin, y4 - penW/5);
pGraphics.ds();
}
CSignRadical.prototype.draw = function(x, y, pGraphics) CSignRadical.prototype.draw = function(x, y, pGraphics)
{ {
var txtPrp = this.Parent.getCtrPrp(); var txtPrp = this.Parent.getCtrPrp();
//var txtPrp = this.Parent.getTxtPrp(); //var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042; var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
y += penW/2; // смещаем, для отрисовки верхней линии радикала y += this.gapTop + penW/2; // смещаем, для отрисовки верхней линии радикала
var x1 = this.pos.x + x, var x1 = this.pos.x + x,
x2 = x1 + 0.048*txtPrp.FontSize; x2 = x1 + 0.048*txtPrp.FontSize;
var y2 = this.pos.y + y + this.size.height - this.measure.heightTick, var Height = this.size.height - this.gapTop;
var y2 = this.pos.y + y + Height - this.measure.heightTick,
y1 = y2 + 0.0242*txtPrp.FontSize; y1 = y2 + 0.0242*txtPrp.FontSize;
var tg = 0.048/0.0242; var tg = 0.048/0.0242;
...@@ -42,7 +184,7 @@ CSignRadical.prototype.draw = function(x, y, pGraphics) ...@@ -42,7 +184,7 @@ CSignRadical.prototype.draw = function(x, y, pGraphics)
var sin = 0.876, var sin = 0.876,
cos = 0.474; cos = 0.474;
var y4 = this.pos.y + y + this.size.height - penW; var y4 = this.pos.y + y + Height - penW;
var y5 = y4 + penW/2*cos; var y5 = y4 + penW/2*cos;
// 0.048*txtPrp.FontSize + (- penW + this.measure.heightTick + 0.92*penW / tg )/ tg // 0.048*txtPrp.FontSize + (- penW + this.measure.heightTick + 0.92*penW / tg )/ tg
...@@ -101,8 +243,8 @@ CSignRadical.prototype.draw = function(x, y, pGraphics) ...@@ -101,8 +243,8 @@ CSignRadical.prototype.draw = function(x, y, pGraphics)
pGraphics.b_color1(0,0,0, 255); pGraphics.b_color1(0,0,0, 255);
pGraphics._s(); pGraphics._s();
pGraphics._m(x4 - penW*0.6*sin, y4 - penW/4); pGraphics._m(x4 - penW*0.6*sin, y4 - penW/5);
pGraphics._l(x5 + penW/3*sin, y4 - penW/4); pGraphics._l(x5 + penW/3*sin, y4 - penW/5);
pGraphics.ds(); pGraphics.ds();
} }
...@@ -112,13 +254,324 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -112,13 +254,324 @@ CSignRadical.prototype.recalculateSize = function()
var sizeArg = this.Parent.getBase().size; var sizeArg = this.Parent.getBase().size;
var height, width; var height, width;
var plH = 9.877777777777776 * txtPrp.FontSize/36;
var top = txtPrp.FontSize*g_dKoef_pt_to_mm*0.15, var gapSign = txtPrp.FontSize*g_dKoef_pt_to_mm*0.077108, /// SIGN_GAP
heightArg = sizeArg.height + top, heightArg = sizeArg.height + gapSign,
widthArg = sizeArg.width; widthArg = sizeArg.width;
this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*0.094492; /// GAP_TOP
this.gapSign = gapSign;
///// height ////// ///// height //////
var plH = 9.877777777777776 * txtPrp.FontSize /36;
/*var H0 = plH*1.2,
H1 = plH*1.50732421875,
H2 = plH*2.760986328125,
H3 = plH*4.217578125,
H4 = plH*5.52197265625,
H5 = plH*7.029296875;*/
/*var RADICAL_H0 = 1.2;
var RADICAL_H1 = 1.50732421875;
var RADICAL_H2 = 2.8;
var RADICAL_H3 = 4.08;
var RADICAL_H4 = 5.7;
var RADICAL_H5 = 7.15;*/
//var RADICAL_H1 = 1.50732421875;
var H0 = plH*1.037,
H1 = plH*1.50732421875,
H2 = plH*2.8,
H3 = plH*4.08,
H4 = plH*5.7,
H5 = plH*7.15;
this.measure.bHigh = false;
if( heightArg < H0 )
height = H0*1.082;
//height = H0*1.058;
else if( heightArg < H1 )
height = H1;
else if( heightArg < H2 )
height = H2;
else if( heightArg < H3 )
height = H3*1.04;
else if( heightArg < H4 )
height = H4;
else if( heightArg < H5 )
height = H5;
else
{
height = heightArg;
this.measure.bHigh = true;
}
//////
///// Size of tick //////
var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
maxHgtTick = 1.2*plH;
var heightTick, widthSlash,
gapLeft;
if ( heightArg > maxHgtRad )
{
heightTick = maxHgtTick;
widthSlash = plH * 0.67;
gapLeft = 0.2*plH;
}
else
{
var H;
if(heightArg < H1)
{
H = H1;
var zetta = height < H1 ? 0.75 : 0.82;
widthSlash = plH *zetta;
}
else
{
H = height;
widthSlash = plH * 0.8681086138556986;
}
var alpha = (H - minHgtRad)/(2*maxHgtRad);
heightTick = minHgtTick*(1 + alpha);
gapLeft = 0.12683105468750022* plH;
}
this.measure.widthSlash = widthSlash;
this.measure.heightTick = heightTick;
this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize;
////// width, height //////
width = widthSlash + gapLeft + widthArg;
height += this.gapTop;
//////
this.size = {height: height, width: width};
}
CSignRadical.prototype.old_recalculateSize = function()
{
var txtPrp = this.Parent.getCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
var plH = 9.877777777777776 * txtPrp.FontSize/36;
var SUM = 0.1216 + 0.05;
SIGN_GAP = SUM - GAP_TOP;
var gapSign = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP,
heightArg = sizeArg.height + gapSign,
widthArg = sizeArg.width;
this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*GAP_TOP;
this.gapSign = gapSign;
// this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP;
//console.log("Gap sign : " + gapSign);
///// height //////
/*var H0 = plH*1.2,
H1 = plH*1.50732421875,
H2 = plH*2.760986328125,
H3 = plH*4.217578125,
H4 = plH*5.52197265625,
H5 = plH*7.029296875;*/
var H0 = RADICAL_H0*plH,
H1 = RADICAL_H1*plH,
H2 = RADICAL_H2*plH,
H3 = RADICAL_H3*plH,
H4 = RADICAL_H4*plH,
H5 = RADICAL_H5*plH;
// RADICAL_GAP =0.1216;
// SIGN_GAP = 0.05;
/*var H0 = plH*1.0992;
var H1 = plH*1.56542421875;
var H2 = plH*2.8275863281249998;
var H3 = plH*4.154778125;
var H4 = plH*5.7241726562499995;
var H5 = plH*7.167896874999999;*/
/*H0 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H1 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H2 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H3 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H4 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H5 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;*/
/*H0 += gapSign;
H1 += gapSign;
H2 += gapSign;
H3 += gapSign;
H4 += gapSign;
H5 += gapSign;*/
this.measure.bHigh = false;
if( heightArg < H0 )
height = H0*1.058;
else if( heightArg < H1 )
height = H1;
else if( heightArg < H2 )
height = H2;
else if( heightArg < H3 )
height = H3*1.04;
else if( heightArg < H4 )
height = H4;
else if( heightArg < H5 )
height = H5;
else
{
height = heightArg;
this.measure.bHigh = true;
}
/*if(this.gapTop < g_dKoef_pt_to_mm)
{
this.gapTop = g_dKoef_pt_to_mm;
height += g_dKoef_pt_to_mm;
}*/
//////
/*console.log("H0: "+ H0);
console.log("H1: "+ H1);
console.log("H2: "+ H2);
console.log("H3: "+ H3);
console.log("H4: "+ H4);
console.log("H5: "+ H5);*/
console.log("SIGN_GAP :" + SIGN_GAP);
console.log("GAP_TOP : " + GAP_TOP);
console.log("RADICAL_H0: "+ H0/plH);
console.log("RADICAL_H1: "+ H1/plH);
console.log("RADICAL_H2: "+ H2/plH);
console.log("RADICAL_H3: "+ H3/plH);
console.log("RADICAL_H4: "+ H4/plH);
console.log("RADICAL_H5: "+ H5/plH);
///// Size of tick //////
var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
maxHgtTick = 1.2*plH;
var heightTick, widthSlash,
gapLeft;
if ( heightArg > maxHgtRad )
{
heightTick = maxHgtTick;
widthSlash = plH * 0.67;
gapLeft = 0.2*plH;
}
else
{
var H;
if(heightArg < H1)
{
H = H1;
var zetta = height < H1 ? 0.75 : 0.82;
widthSlash = plH *zetta;
}
else
{
H = height;
widthSlash = plH * 0.8681086138556986;
}
var alpha = (H - minHgtRad)/(2*maxHgtRad);
heightTick = minHgtTick*(1 + alpha);
gapLeft = 0.12683105468750022* plH;
}
this.measure.widthSlash = widthSlash;
this.measure.heightTick = heightTick;
this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize;
////// width, height //////
width = widthSlash + gapLeft + widthArg;
height += this.gapTop;
//////
//console.log("Gap top : " + this.gapTop);
/*console.log("SIGN_GAP: " + SIGN_GAP);
console.log("RADICAL_GAP: " + RADICAL_GAP);
console.log("RADICAL_H0: " + RADICAL_H0);
console.log("RADICAL_H1: " + RADICAL_H1);
console.log("RADICAL_H2: " + RADICAL_H2);
console.log("RADICAL_H3: " + RADICAL_H3);
console.log("RADICAL_H4: " + RADICAL_H4);
console.log("RADICAL_H5: " + RADICAL_H5);*/
//console.log("Height: " + height);
this.size = {height: height, width: width};
}
CSignRadical.prototype.old_old_recalculateSize = function()
{
var txtPrp = this.Parent.getCtrPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
var plH = 9.877777777777776 * txtPrp.FontSize/36;
var SUM = 0.1216 + 0.05;
SIGN_GAP = SUM - GAP_TOP;
var gapSign = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP,
heightArg = sizeArg.height + gapSign,
widthArg = sizeArg.width;
this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*GAP_TOP;
this.gapSign = gapSign;
// this.gapTop = txtPrp.FontSize*g_dKoef_pt_to_mm*SIGN_GAP;
//console.log("Gap sign : " + gapSign);
///// height //////
var H0 = plH*1.2, var H0 = plH*1.2,
H1 = plH*1.50732421875, H1 = plH*1.50732421875,
H2 = plH*2.760986328125, H2 = plH*2.760986328125,
...@@ -126,10 +579,35 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -126,10 +579,35 @@ CSignRadical.prototype.recalculateSize = function()
H4 = plH*5.52197265625, H4 = plH*5.52197265625,
H5 = plH*7.029296875; H5 = plH*7.029296875;
// RADICAL_GAP =0.1216;
// SIGN_GAP = 0.05;
/*var H0 = plH*1.0992;
var H1 = plH*1.56542421875;
var H2 = plH*2.8275863281249998;
var H3 = plH*4.154778125;
var H4 = plH*5.7241726562499995;
var H5 = plH*7.167896874999999;*/
H0 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H1 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H2 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H3 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H4 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
H5 += gapSign - txtPrp.FontSize*g_dKoef_pt_to_mm*0.2;
/*H0 += gapSign;
H1 += gapSign;
H2 += gapSign;
H3 += gapSign;
H4 += gapSign;
H5 += gapSign;*/
this.measure.bHigh = false; this.measure.bHigh = false;
if( heightArg < H0 ) if( heightArg < H0 )
height = H1*0.85; height = H0*1.058;
else if( heightArg < H1 ) else if( heightArg < H1 )
height = H1; height = H1;
else if( heightArg < H2 ) else if( heightArg < H2 )
...@@ -148,6 +626,22 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -148,6 +626,22 @@ CSignRadical.prototype.recalculateSize = function()
////// //////
/*console.log("H0: "+ H0);
console.log("H1: "+ H1);
console.log("H2: "+ H2);
console.log("H3: "+ H3);
console.log("H4: "+ H4);
console.log("H5: "+ H5);*/
console.log("SIGN_GAP :" + SIGN_GAP);
console.log("GAP_TOP : " + GAP_TOP);
console.log("RADICAL_H0: "+ H0/plH);
console.log("RADICAL_H1: "+ H1/plH);
console.log("RADICAL_H2: "+ H2/plH);
console.log("RADICAL_H3: "+ H3/plH);
console.log("RADICAL_H4: "+ H4/plH);
console.log("RADICAL_H5: "+ H5/plH);
///// Size of tick ////// ///// Size of tick //////
var minHgtRad = plH * 1.130493164, var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875; maxHgtRad = plH * 7.029296875;
...@@ -156,14 +650,14 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -156,14 +650,14 @@ CSignRadical.prototype.recalculateSize = function()
maxHgtTick = 1.2*plH; maxHgtTick = 1.2*plH;
var heightTick, widthSlash, var heightTick, widthSlash,
gap; gapLeft;
if ( heightArg > maxHgtRad ) if ( heightArg > maxHgtRad )
{ {
heightTick = maxHgtTick; heightTick = maxHgtTick;
widthSlash = plH * 0.67; widthSlash = plH * 0.67;
gap = 0.2*plH; gapLeft = 0.2*plH;
} }
else else
{ {
...@@ -172,7 +666,8 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -172,7 +666,8 @@ CSignRadical.prototype.recalculateSize = function()
if(heightArg < H1) if(heightArg < H1)
{ {
H = H1; H = H1;
widthSlash = plH * 0.75; var zetta = height < H1 ? 0.75 : 0.82;
widthSlash = plH *zetta;
} }
else else
{ {
...@@ -182,7 +677,7 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -182,7 +677,7 @@ CSignRadical.prototype.recalculateSize = function()
var alpha = (H - minHgtRad)/(2*maxHgtRad); var alpha = (H - minHgtRad)/(2*maxHgtRad);
heightTick = minHgtTick*(1 + alpha); heightTick = minHgtTick*(1 + alpha);
gap = 0.12683105468750022* plH; gapLeft = 0.12683105468750022* plH;
} }
...@@ -191,10 +686,25 @@ CSignRadical.prototype.recalculateSize = function() ...@@ -191,10 +686,25 @@ CSignRadical.prototype.recalculateSize = function()
this.measure.heightTick = heightTick; this.measure.heightTick = heightTick;
this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize; this.measure.widthTick = 0.1196002747872799*txtPrp.FontSize;
////// width ////// ////// width, height //////
width = widthSlash + gap + widthArg; width = widthSlash + gapLeft + widthArg;
height += this.gapTop;
////// //////
//console.log("Gap top : " + this.gapTop);
/*console.log("SIGN_GAP: " + SIGN_GAP);
console.log("RADICAL_GAP: " + RADICAL_GAP);
console.log("RADICAL_H0: " + RADICAL_H0);
console.log("RADICAL_H1: " + RADICAL_H1);
console.log("RADICAL_H2: " + RADICAL_H2);
console.log("RADICAL_H3: " + RADICAL_H3);
console.log("RADICAL_H4: " + RADICAL_H4);
console.log("RADICAL_H5: " + RADICAL_H5);*/
//console.log("Height: " + height);
this.size = {height: height, width: width}; this.size = {height: height, width: width};
} }
CSignRadical.prototype.old_draw = function(x, y, pGraphics) CSignRadical.prototype.old_draw = function(x, y, pGraphics)
...@@ -407,20 +917,23 @@ CRadical.prototype.init = function(props) ...@@ -407,20 +917,23 @@ CRadical.prototype.init = function(props)
this.addMCToContent(oDegree, oBase); this.addMCToContent(oDegree, oBase);
} }
} }
CRadical.prototype.recalculateSize = function() CRadical.prototype.recalculateSize = function(oMeasure)
{ {
this.signRadical.recalculateSize(); this.signRadical.recalculateSize(oMeasure);
var txtPrp = this.getCtrPrp(); var txtPrp = this.getCtrPrp();
var gapTop = 2.2*txtPrp.FontSize /36, var sign = this.signRadical.size,
sign = this.signRadical.size; gTop = this.signRadical.gapTop,
gSign = this.signRadical.gapSign > 3*g_dKoef_pt_to_mm ? this.signRadical.gapSign : 3*g_dKoef_pt_to_mm ;// делаем смещение, т.к. для fontSize 11, 14 и меньше высота плейсхолдера не совпадает
// с высотой отрисовки плейсхолдера и происходит
// наложение черты значка радикала и плейсхолдера
var gapTop = gTop + gSign;
if(this.type == SQUARE_RADICAL) if(this.type == SQUARE_RADICAL)
{ {
var base = this.elements[0][0].size; var base = this.elements[0][0].size;
var shTop = (sign.height - gSign - base.height)/2;
var shTop = (sign.height - gapTop - base.height)/2;
var height = sign.height, var height = sign.height,
width = sign.width, width = sign.width,
...@@ -444,7 +957,7 @@ CRadical.prototype.recalculateSize = function() ...@@ -444,7 +957,7 @@ CRadical.prototype.recalculateSize = function()
var plH = 9.877777777777776 * txtPrp.FontSize /36; var plH = 9.877777777777776 * txtPrp.FontSize /36;
if( sign.height < plH ) if( sign.height < plH )
this.gap = 1.5*txtPrp.FontSize/36; this.gap = 1.3*txtPrp.FontSize/36;
else else
this.gap = 3.5*txtPrp.FontSize/36; this.gap = 3.5*txtPrp.FontSize/36;
...@@ -452,19 +965,17 @@ CRadical.prototype.recalculateSize = function() ...@@ -452,19 +965,17 @@ CRadical.prototype.recalculateSize = function()
h2 = sign.height; h2 = sign.height;
var height, ascent; var height, ascent;
var shTop = (sign.height - gapTop - base.height)/2; var shTop = (sign.height - gSign - base.height)/2;
if(h1 > h2) if(h1 > h2)
{ {
height = h1; height = h1;
ascent = height - shTop - (base.height - base.ascent); ascent = height - sign.height + gapTop + shTop + base.ascent;
//ascent = height - (base.height - base.ascent);
} }
else else
{ {
height = h2; height = h2;
ascent = height - shTop - (base.height - base.ascent); ascent = gapTop + shTop + base.ascent;
//ascent = height - (base.height - base.ascent);
} }
this.size = {width: width, height: height, ascent: ascent}; this.size = {width: width, height: height, ascent: ascent};
...@@ -622,6 +1133,26 @@ CRadical.prototype.findDisposition = function(mCoord) ...@@ -622,6 +1133,26 @@ CRadical.prototype.findDisposition = function(mCoord)
} }
CRadical.prototype.draw = function(x, y, pGraphics) CRadical.prototype.draw = function(x, y, pGraphics)
{ {
////// test //////
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();*/
this.signRadical.draw(x, y, pGraphics); this.signRadical.draw(x, y, pGraphics);
CRadical.superclass.draw.call(this, x, y, pGraphics); CRadical.superclass.draw.call(this, x, y, pGraphics);
} }
......
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