Commit 2384a6b4 authored by Anna.Pavlova's avatar Anna.Pavlova

degree, radical (new)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48007 954022d7-b5bf-4e40-9824-e11837661b57
parent 6818bad3
...@@ -5,18 +5,16 @@ function CDegreeOrdinary() ...@@ -5,18 +5,16 @@ function CDegreeOrdinary()
CMathBase.call(this); CMathBase.call(this);
} }
extend(CDegreeOrdinary, CMathBase); extend(CDegreeOrdinary, CMathBase);
CDegreeOrdinary.prototype.setContent = function() CDegreeOrdinary.prototype.init = function()
{ {
this.init(1, 2); this.setDimension(1, 2);
var oBase = new CMathContent(); var oBase = new CMathContent();
oBase.fillPlaceholders();
var oDegree = new CMathContent(); var oDegree = new CMathContent();
oDegree.fillPlaceholders();
oDegree.setReduct(DEGR_REDUCT); oDegree.setReduct(DEGR_REDUCT);
this.addMCToContent(1, 2, [oBase, oDegree]); this.addMCToContent(oBase, oDegree);
} }
CDegreeOrdinary.prototype.old_setContent = function() CDegreeOrdinary.prototype.old_setContent = function()
{ {
...@@ -39,7 +37,7 @@ CDegreeOrdinary.prototype.old_setContent = function() ...@@ -39,7 +37,7 @@ CDegreeOrdinary.prototype.old_setContent = function()
CDegreeOrdinary.superclass.setContent.call(this, oBase, oDegree); CDegreeOrdinary.superclass.setContent.call(this, oBase, oDegree);
} }
CDegreeOrdinary.prototype.setIndex = function() CDegreeOrdinary.prototype.setIndex = function(index)
{ {
this.index = index; this.index = index;
} }
...@@ -197,9 +195,14 @@ CDegreeOrdinary.prototype.getBase = function() ...@@ -197,9 +195,14 @@ CDegreeOrdinary.prototype.getBase = function()
function CIterators() function CIterators()
{ {
CMathBase.call(this, 2, 1); CMathBase.call(this);
} }
extend(CIterators, CMathBase); extend(CIterators, CMathBase);
CIterators.prototype.init = function()
{
this.setDimension(2, 1);
this.setContent();
}
CIterators.prototype.setDistance = function() CIterators.prototype.setDistance = function()
{ {
var descF = this.elements[0][0].size.height - this.elements[0][0].size.center , var descF = this.elements[0][0].size.height - this.elements[0][0].size.center ,
...@@ -239,29 +242,22 @@ CIterators.prototype.getLowerIterator = function() ...@@ -239,29 +242,22 @@ CIterators.prototype.getLowerIterator = function()
function CDegreeSubSup(type) function CDegreeSubSup(type)
{ {
CSubMathBase.call(this, 1, 2);
this.type = type; this.type = type;
CSubMathBase.call(this);
} }
extend(CDegreeSubSup, CSubMathBase); extend(CDegreeSubSup, CSubMathBase);
CDegreeSubSup.prototype.old_setContent = function() CDegreeSubSup.prototype.init = function()
{ {
var oBase = new CMathContent();
var oBase = null; this.init_2(oBase);
if(arguments.length > 0) }
oBase = arguments[0]; CDegreeSubSup.prototype.init_2 = function(oBase)
else {
{ this.setDimension(1, 2);
oBase = new CMathBase(1, 1);
oBase.init( this.params );
oBase.relate(this);
oBase.fillPlaceholders();
}
var oIters = new CIterators(); var oIters = new CIterators();
oIters.init( this.params ); oIters.init();
oIters.relate(this); oIters.setReduct(DEGR_REDUCT);
oIters.fillPlaceholders();
oIters.setFont(getTypeDegree(this.params.font), -1);
oIters.lUp = 0; oIters.lUp = 0;
oIters.lD = 0; oIters.lD = 0;
...@@ -269,23 +265,22 @@ CDegreeSubSup.prototype.old_setContent = function() ...@@ -269,23 +265,22 @@ CDegreeSubSup.prototype.old_setContent = function()
if(this.type == 0) if(this.type == 0)
{ {
oIters.alignHor(-1, 0); oIters.alignHor(-1, 0);
CDegreeSubSup.superclass.setContent.call(this, oBase, oIters); this.addMCToContent(oBase, oIters);
} }
else else
{ {
oIters.alignHor(-1, 1); oIters.alignHor(-1, 1);
CDegreeSubSup.superclass.setContent.call(this, oIters, oBase); this.addMCToContent(oIters, oBase);
} }
} }
CDegreeSubSup.prototype.setContent = function() CDegreeSubSup.prototype.old_setContent = function()
{ {
var oBase = null; var oBase = null;
if(arguments.length > 0) if(arguments.length > 0)
oBase = arguments[0]; oBase = arguments[0];
else else
{ {
oBase = new CMathContent(1, 1); oBase = new CMathContent();
oBase.init( this.params ); oBase.init( this.params );
oBase.relate(this); oBase.relate(this);
oBase.fillPlaceholders(); oBase.fillPlaceholders();
......
...@@ -190,6 +190,18 @@ CMathContent.prototype = ...@@ -190,6 +190,18 @@ CMathContent.prototype =
case 3: case 3:
mathElem = new CDegreeOrdinary(); mathElem = new CDegreeOrdinary();
break; break;
case 4:
mathElem = new CDegreeSubSup(0);
break;
case 5:
mathElem = new CDegreeSubSup(1);
break;
case 6:
mathElem = new CRadical();
break;
case 7:
mathElem = new CDegreeRadical();
break;
} }
if( mathElem !== null ) if( mathElem !== null )
...@@ -280,16 +292,84 @@ CMathContent.prototype = ...@@ -280,16 +292,84 @@ CMathContent.prototype =
var den = fract.getDenominator(); var den = fract.getDenominator();
den.addTxt("2"); den.addTxt("2");
break; break;
/*case 9: case 9:
var degr = this.createMComponent(3); var degr = this.createMComponent(3);
degr.init(); degr.init();
degr.setIndex(1); degr.setIndex(1);
degr.fillPlaceholders();
break; break;
case 10: case 10:
var degr = this.createMComponent(3); var degr = this.createMComponent(3);
degr.init(); degr.init();
degr.setIndex(-1); degr.setIndex(-1);
break;*/ degr.fillPlaceholders();
break;
case 11:
var degrSupSup = this.createMComponent(4);
degrSupSup.init();
degrSupSup.fillPlaceholders();
break;
case 12:
var degrSupSup = this.createMComponent(5);
degrSupSup.init();
degrSupSup.fillPlaceholders();
break;
case 13:
var degr = this.createMComponent(3);
degr.init();
degr.setIndex(-1);
var base = degr.getBase();
base.addTxt("x");
var iter = degr.getIterator();
var degr2 = iter.createMComponent(3);
degr2.init();
degr2.setIndex(1);
var base2 = degr2.getBase();
base2.addTxt("y");
var iter2 = degr2.getIterator();
iter2.addTxt("2");
break;
case 14:
var degr = this.createMComponent(3);
degr.init();
degr.setIndex(1);
var base = degr.getBase();
base.addTxt("e");
var iter = degr.getIterator();
iter.addTxt("-iωt");
break;
case 15:
var degr = this.createMComponent(3);
degr.init();
degr.setIndex(1);
var base = degr.getBase();
base.addTxt("x");
var iter = degr.getIterator();
iter.addTxt("2");
break;
case 16:
var degr = this.createMComponent(5);
degr.init();
var base = degr.getBase();
base.addTxt("Y");
var iter1 = degr.getUpperIterator();
iter1.addTxt("n");
var iter2 = degr.getLowerIterator();
iter2.addTxt("1");
break;
case 17:
var rad = this.createMComponent(6);
rad.init();
rad.fillPlaceholders();
break;
case 18:
var rad = this.createMComponent(7);
rad.init();
rad.fillPlaceholders();
break;
} }
}, },
removeAreaSelect: function() removeAreaSelect: function()
......
function getHeightTick(metrics, height) function CSignRadical()
{ {
var minHgtRad = metrics.Height * 0.75, this.Parent = null;
maxHgtRad = 4*metrics.Height + metrics.Placeholder.Height; this.pos = null;
var minHgtTick = metrics.Placeholder.Height*0.6, this.size = null;
maxHgtTick = metrics.Height; this.sizeTick = null;
this.widthSlash = null;
}
CSignRadical.prototype.draw = function()
{
var txtPrp = this.Parent.getTxtPrp();
var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
var plH = 9.877777777777776 * txtPrp.FontSize /36;
var x1 = this.pos.x,
x2 = x1 + 0.25*this.widthSlash;
var y2 = this.pos.y + this.size.height -this.sizeTick.height,
y1 = y2 + 0.11*this.widthSlash;
var tX = 1.7*penW * 0.5 * 25.4/96,
tY = (-1)*tX * 11/25 *0.5; // 11/25 - тангенс угла наклона
var x3 = x2 - tX,
y3 = y2 - tY;
/*var minHeight = plH * 1.1304931640625,
maxHeight = plH * 7.029296875;
var maxWidth = plH * 0.81171875;
var k = 0.2*maxWidth/(maxHeight - minHeight),
b = maxWidth*0.3 - k*minHeight;*/
var k = 0.00343247*this.widthSlash,
b = 0.3*this.widthSlash - 1.130493*plH*k;
if(this.size.height < plH*7.029296875)
x4 = x3 + k*this.size.height + b;
else
x4 = x1 + this.widthSlash;
var y4 = this.pos.y + this.size.height - penW;
var x5 = x1 + this.widthSlash,
x6 = this.pos.x + this.size.width;
var y5 = this.pos.y,
y6 = this.pos.y;
MathControl.pGraph.p_width(penW*0.8*1000);
MathControl.pGraph.p_color(0,0,0, 255);
MathControl.pGraph.b_color1(0,0,0, 255);
MathControl.pGraph._s();
MathControl.pGraph._m(x1, y1);
MathControl.pGraph._l(x2, y2);
MathControl.pGraph.ds();
MathControl.pGraph.p_width(1.7*penW*1000);
MathControl.pGraph._s();
MathControl.pGraph._m(x3, y3);
MathControl.pGraph._l(x4, y4);
MathControl.pGraph.ds();
MathControl.pGraph.p_width(penW*1000);
MathControl.pGraph._s();
MathControl.pGraph._m(x4, y4);
MathControl.pGraph._l(x5, y5);
MathControl.pGraph._l(x6,y6);
MathControl.pGraph.ds();
}
CSignRadical.prototype.recalculateSize = function()
{
var txtPrp = this.Parent.getTxtPrp();
var sizeArg = this.Parent.getBase().size;
var height, width;
var top = txtPrp.FontSize*g_dKoef_pt_to_mm*0.15,
heightArg = sizeArg.height + top,
widthArg = sizeArg.width;
///// height //////
var plH = 9.877777777777776 * txtPrp.FontSize /36;
var H0 = plH,
H1 = plH*1.50732421875,
H2 = plH*2.760986328125,
H3 = plH*4.217578125,
H4 = plH*5.52197265625,
H5 = plH*7.029296875;
if(heightArg < H0)
height = H1*0.75;
else if( heightArg < H1 )
height = H1;
else if( heightArg < H2 )
height = H2;
else if( heightArg < H3 )
height = H3;
else if( heightArg < H4 )
height = H4;
else if(heightArg < H5)
height = H5;
else
height = heightArg;
//////
///// height tick //////
var minHgtRad = plH * 1.130493164,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
maxHgtTick = plH * 1.50732422;
var heightTick;
if ( heightArg > maxHgtRad )
heightTick = maxHgtTick;
else
{
var alpha = (heightArg - minHgtRad)/maxHgtRad;
heightTick = minHgtTick*(1 + alpha);
}
////// width //////
//var widthSlash = plH * 0.9385498046875003;
var widthSlash = plH * 0.81171875;
gap = 0.12683105468750022* plH;
width = widthSlash + gap + widthArg;
//////
////// tick width /////
var widthTick = 0.1196002747872799*txtPrp.FontSize;
//////
this.sizeTick =
{
width : widthTick,
height : heightTick
};
this.widthSlash = widthSlash;
this.size = {height: height, width: width};
}
CSignRadical.prototype.setPosition = function(pos)
{
this.pos = pos;
}
CSignRadical.prototype.relate = function(parent)
{
this.Parent = parent;
}
function getHeightTick(height, txtPrp)
{
var plH = 9.877777777777776 * txtPrp.FontSize /36;
var minHgtRad = plH * 1.1304931640625,
maxHgtRad = plH * 7.029296875;
var minHgtTick = plH*0.6,
maxHgtTick = plH * 1.50732421875;
var heightTick; var heightTick;
...@@ -18,6 +182,48 @@ function getHeightTick(metrics, height) ...@@ -18,6 +182,48 @@ function getHeightTick(metrics, height)
return heightTick; return heightTick;
} }
function getHeightRadical(height, txtPrp)
{
//var GFont = GetMathFont(txtPrp);
/*var metric = GFont.metrics,
GenHeight;
var gap = metric.Height - metric.Placeholder.Height;*/
/*var H0 = metric.Placeholder.Height,
H1 = metric.Height,
H2 = 2*metric.Placeholder.Height + 1.5*gap,
H3 = 3*metric.Placeholder.Height + 2.4*gap,
H4 = 4*metric.Placeholder.Height + 3*gap,
H5 = 5*metric.Placeholder.Height + 4*gap;*/
var plh = 9.877777777777776*txtPrp.FontSize/36;
var H0 = plh,
H1 = plh*1.50732421875,
H2 = plh*2.760986328125,
H3 = plh*4.217578125,
H4 = plh*5.52197265625,
H5 = plh*7.029296875;
if(height < H0)
GenHeight = H1*0.75;
else if( height < H1 )
GenHeight = H1;
else if( height < H2 )
GenHeight = H2;
else if( height < H3 )
GenHeight = H3;
else if( height < H4 )
GenHeight = H4;
else if(height < H5)
GenHeight = H5;
else
GenHeight = height;
return GenHeight;
}
function DrawingRadical() function DrawingRadical()
{ {
var x = this.pos.x, var x = this.pos.x,
...@@ -26,17 +232,20 @@ function DrawingRadical() ...@@ -26,17 +232,20 @@ function DrawingRadical()
var Height = this.size.height - this.shRadical.y, var Height = this.size.height - this.shRadical.y,
Width = this.size.width - this.shRadical.x; Width = this.size.width - this.shRadical.x;
var penW = this.params.font.FontSize*g_dKoef_pt_to_mm*0.042; var txtPrp = this.getTxtPrp();
var minHeight = this.params.font.metrics.Height * 0.75, var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
maxHeight = 4*this.params.font.metrics.Height + this.params.font.metrics.Placeholder.Height; var plH = 9.877777777777776 * txtPrp.FontSize /36;
var maxWidth = 1.6*(this.params.font.metrics.Height - this.params.font.metrics.Placeholder.Height); var minHeight = plH * 1.1304931640625,
maxHeight = plH * 7.029296875;
var maxWidth = plH * 0.81171875;
var coeff = 0.2*maxWidth/(maxHeight - minHeight), var coeff = 0.2*maxWidth/(maxHeight - minHeight),
b = maxWidth*0.3 - coeff*minHeight; b = maxWidth*0.3 - coeff*minHeight;
var heightTick = getHeightTick(this.params.font.metrics, Height); var heightTick = getHeightTick(Height, txtPrp);
var tX = 1.7*penW * 0.5 * 25.4/96, var tX = 1.7*penW * 0.5 * 25.4/96,
tY = (-1)*tX * 11/25 *0.5; // 11/25 - тангенс угла наклона tY = (-1)*tX * 11/25 *0.5; // 11/25 - тангенс угла наклона
...@@ -88,7 +297,322 @@ function DrawingRadical() ...@@ -88,7 +297,322 @@ function DrawingRadical()
MathControl.pGraph.ds(); MathControl.pGraph.ds();
} }
function CRadical() function CRadical()
{
this.signRadical = null;
CMathBase.call(this);
}
extend(CRadical, CMathBase);
CRadical.prototype.init = function()
{
this.setDimension(1, 1);
this.setContent();
this.signRadical = new CSignRadical();
this.signRadical.relate(this);
}
CRadical.prototype.recalculateSize = function()
{
this.signRadical.recalculateSize();
var sign = this.signRadical.size;
var arg = this.elements[0][0].size;
var height = sign.height,
width = sign.width,
center = (height - arg.height)*0.6 + arg.center;
this.size = {width: width, height: height, center: center};
}
CRadical.prototype.setPosition = function(pos)
{
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;
var x = this.pos.x + this.gapLeft,
y = this.pos.y + this.gapTop;
this.signRadical.setPosition(this.pos);
this.elements[0][0].setPosition({x: x, y: y });
}
CRadical.prototype.findDisposition = function(mCoord)
{
var sizeBase = this.elements[0][0].size;
var X, Y;
var inside_flag = -1;
if(mCoord.x < this.gapLeft)
{
X = 0;
inside_flag = 0;
}
else if(mCoord.x > this.gapLeft + sizeBase.width)
{
X = sizeBase.width;
inside_flag = 1;
}
else
X = mCoord.x - this.gapLeft;
if(mCoord.y < this.gapTop)
{
Y = 0;
inside_flag = 2;
}
else if(mCoord.y > this.gapTop + sizeBase.height)
{
Y = sizeBase.height;
inside_flag = 2;
}
else
Y = mCoord.y - this.gapTop;
return {pos: {x:0, y:0}, mCoord: {x: X, y: Y}, inside_flag: inside_flag};
}
//context.fill() для заливки
//Graphics : df()
CRadical.prototype.draw = function()
{
this.elements[0][0].draw();
this.signRadical.draw();
}
CRadical.prototype.getBase = function()
{
return this.elements[0][0];
}
function CDegreeRadical()
{
this.signRadical = null;
this.gap = null;
this.topDegr = null;
CMathBase.call(this);
}
extend(CDegreeRadical, CMathBase);
CDegreeRadical.prototype.init = function()
{
this.setDimension(1, 2);
this.signRadical = new CSignRadical();
this.signRadical.relate(this);
var oBase = new CMathContent();
var oDegree = new CMathContent();
oDegree.setReduct(DEGR_REDUCT);
this.addMCToContent(oDegree, oBase);
}
CDegreeRadical.prototype.recalculateSize = function()
{
this.signRadical.recalculateSize();
var degr = this.elements[0][0].size,
base = this.elements[0][1].size,
sign = this.signRadical.size;
var wTick = this.signRadical.sizeTick.width,
hTick = this.signRadical.sizeTick.height;
var width = degr.width - wTick + sign.width;
var txtPrp = this.Parent.getTxtPrp();
var plH = 9.877777777777776 * txtPrp.FontSize /36;
if( sign.height < plH )
this.gap = 1.5*txtPrp.FontSize/36;
else
this.gap = 3.5*txtPrp.FontSize/36;
var h1 = degr.height + this.gap + hTick,
h2 = sign.height;
var height, center;
if(h1 > h2)
{
height = h1;
center = h1 - h2 + (sign.height - base.height)*0.6 + base.center;
}
else
{
height = h2;
center = (sign.height - base.height)*0.6 + base.center;
}
/*var metrics = this.params.font.metrics,
fontSize = this.params.font.FontSize;
// ширина
var width, height, center;
var widthToBase = 1.85*(metrics.Height - metrics.Placeholder.Height);
var tickWidth = 0.1196002747872799*fontSize, *//*расстояение значка радикала, над которым рисуется степень*//*
tGap = widthToBase - tickWidth;
width = degr.width + tGap + base.width;
this.shBase.x = degr.width + tGap;
this.shRadical.x = degr.width - tickWidth; // смещаем на ширину степени минус то расстояние радикала, над которым рисуется степень
this.shDegr.x = 0;
// высота
var top = fontSize*g_dKoef_pt_to_mm*0.15; // gap сверху от аргумента
var penW = fontSize*g_dKoef_pt_to_mm*0.042;
// высота значка радикала
var heightRadical = getHeightRadical(base.height + top, this.params.font);
heightRadical += penW;
// высота "галки" радикала
var heightTick = getHeightTick(metrics, heightRadical);
// высота "степени" + "галка"
if( base.height + top < metrics.Placeholder.Height )
gap = 1.5*fontSize/36;
else
gap = 3.5*fontSize/36;
var shift = gap + heightTick;
var hDgr = shift + degr.height,
jDegr = (heightRadical - base.height + top + penW)/2;
// общая высота
if( hDgr > heightRadical)
{
height = hDgr;
this.shBase.y = hDgr - heightRadical + jDegr;
this.shDegr.y = 0;
this.shRadical.y = hDgr - heightRadical;
}
else
{
height = heightRadical;
this.shDegr.y = heightRadical - hDgr;
this.shBase.y = jDegr;
this.shRadical.y = 0;
}
center = this.shBase.y + base.center;*/
this.size = {width: width, height: height, center: center};
}
CDegreeRadical.prototype.setPosition = function(pos)
{
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;
var hDg = degr.height + this.gap + this.signRadical.sizeTick.height;
this.topDegr = this.size.height - hDg;
var x1 = this.pos.x,
y1 = this.pos.y + this.topDegr;
this.elements[0][0].setPosition({x: x1, y: y1});
var x2 = this.pos.x + degr.width - this.signRadical.sizeTick.width,
y2 = this.pos.y + this.size.height - sign.height;
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;
this.elements[0][1].setPosition({x: x3, y: y3});
}
CDegreeRadical.prototype.draw = function()
{
this.signRadical.draw();
CDegreeRadical.superclass.draw.call(this);
}
CDegreeRadical.prototype.findDisposition = function(mCoord)
{
var mouseCoord = {x: null, y: null},
posCurs = {x: 0, y: null},
inside_flag = -1;
var degr = this.elements[0][0].size,
base = this.elements[0][1].size;
if(mCoord.x < this.size.width - base.width)
{
posCurs.y = 0;
if(mCoord.x > degr.width)
{
mouseCoord.x = degr.width;
inside_flag = 1;
}
else
{
mouseCoord.x = mCoord.x;
}
mouseCoord.x = mCoord.x;
if(mCoord.y < this.topDegr)
{
mouseCoord.y = 0;
inside_flag = 2;
}
else if(mCoord.y > degr.height + this.topDegr)
{
mouseCoord.y = degr.height;
inside_flag = 2;
}
else
{
mouseCoord.y = mCoord.y - this.topDegr;
}
}
else
{
posCurs.y = 1;
mouseCoord.x = mCoord.x - (this.size.width - base.width);
var topBase = this.size.center - base.center;
if(mCoord.y < topBase)
{
mouseCoord.y = 0;
inside_flag = 2;
}
else if(mCoord.y > base.height + topBase)
{
mouseCoord.y = base.height;
inside_flag = 2;
}
else
mouseCoord.y = mCoord.y - topBase;
}
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
CDegreeRadical.prototype.getBase = function()
{
return this.elements[0][1];
}
CDegreeRadical.prototype.getDegree = function()
{
return this.elements[0][0];
}
function old_CRadical()
{ {
this.gapTop = 0; this.gapTop = 0;
this.gapLeft = 0; this.gapLeft = 0;
...@@ -99,26 +623,31 @@ function CRadical() ...@@ -99,26 +623,31 @@ function CRadical()
y: 0 y: 0
}; };
CMathBase.call(this, 1, 1); CMathBase.call(this);
} }
extend(CRadical, CMathBase); extend(old_CRadical, CMathBase);
CRadical.prototype.setContent = function() old_CRadical.prototype.init = function()
{ {
this.fillPlaceholders(); this.setDimension(1, 1);
this.setContent();
} }
CRadical.prototype.recalculateSize = function() old_CRadical.prototype.recalculateSize = function()
{ {
var arg = this.elements[0][0].size; var arg = this.elements[0][0].size;
var txtPrp = this.getTxtPrp();
//var font = GetMathFont(txtPrp);
//var l = 1.85*(font.metrics.Height - font.metrics.Placeholder.Height);
var height, width, center, var height, width, center,
left = 1.85*(this.params.font.metrics.Height - this.params.font.metrics.Placeholder.Height); left = 9.270786404079862 * txtPrp.FontSize/ 36;
var top = this.params.font.FontSize*g_dKoef_pt_to_mm*0.15; var top = txtPrp.FontSize*g_dKoef_pt_to_mm*0.15;
var penW = this.params.font.FontSize*g_dKoef_pt_to_mm*0.042; var penW = txtPrp.FontSize*g_dKoef_pt_to_mm*0.042;
//var penW = 1* 25.4/96; //mm //var penW = 1* 25.4/96; //mm
height = getStateHeight_3(arg.height + top, this.params.font); height = getHeightRadical(arg.height + top, txtPrp);
height += penW; height += penW;
width = arg.width + left; width = arg.width + left;
...@@ -130,7 +659,7 @@ CRadical.prototype.recalculateSize = function() ...@@ -130,7 +659,7 @@ CRadical.prototype.recalculateSize = function()
this.size = {width: width, height: height, center: center}; this.size = {width: width, height: height, center: center};
} }
CRadical.prototype.setPosition = function(pos) old_CRadical.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.center};
var x = this.pos.x + this.gapLeft, var x = this.pos.x + this.gapLeft,
...@@ -138,30 +667,29 @@ CRadical.prototype.setPosition = function(pos) ...@@ -138,30 +667,29 @@ CRadical.prototype.setPosition = function(pos)
this.elements[0][0].setPosition({x: x, y: y }); this.elements[0][0].setPosition({x: x, y: y });
} }
CRadical.prototype.mouseDown = function(pos) old_CRadical.prototype.mouseDown = function(pos)
{ {
var coord = {x: pos.x - this.gapLeft, y: pos.y - this.gapTop}; var coord = {x: pos.x - this.gapLeft, y: pos.y - this.gapTop};
return CRadical.superclass.mouseDown.call(this, coord); return old_CRadical.superclass.mouseDown.call(this, coord);
} }
CRadical.prototype.mouseMove = function(pos) old_CRadical.prototype.mouseMove = function(pos)
{ {
var coord = {x: pos.x - this.gapLeft, y: pos.y - this.gapTop}; var coord = {x: pos.x - this.gapLeft, y: pos.y - this.gapTop};
return CRadical.superclass.mouseMove.call(this, coord); return old_CRadical.superclass.mouseMove.call(this, coord);
} }
//context.fill() для заливки //context.fill() для заливки
//Graphics : df() //Graphics : df()
old_CRadical.prototype.draw = function()
CRadical.prototype.draw = function()
{ {
CRadical.superclass.draw.call(this); old_CRadical.superclass.draw.call(this);
DrawingRadical.call(this); DrawingRadical.call(this);
} }
CRadical.prototype.getBase = function() old_CRadical.prototype.getBase = function()
{ {
return this.elements[0][0]; return this.elements[0][0];
} }
function CDegreeRadical() function old_CDegreeRadical()
{ {
this.shDegr = this.shDegr =
{ {
...@@ -183,8 +711,8 @@ function CDegreeRadical() ...@@ -183,8 +711,8 @@ function CDegreeRadical()
CMathBase.call(this, 1, 2); CMathBase.call(this, 1, 2);
} }
extend(CDegreeRadical, CMathBase); extend(old_CDegreeRadical, CMathBase);
CDegreeRadical.prototype.old_setContent = function() old_CDegreeRadical.prototype.old_setContent = function()
{ {
var oBase = new CMathBase(1, 1); var oBase = new CMathBase(1, 1);
oBase.init( this.params ); oBase.init( this.params );
...@@ -200,7 +728,7 @@ CDegreeRadical.prototype.old_setContent = function() ...@@ -200,7 +728,7 @@ CDegreeRadical.prototype.old_setContent = function()
CDegreeOrdinary.superclass.setContent.call(this, oDegree, oBase); CDegreeOrdinary.superclass.setContent.call(this, oDegree, oBase);
} }
CDegreeRadical.prototype.setContent = function() old_CDegreeRadical.prototype.setContent = function()
{ {
var oBase = new CMathContent(1, 1); var oBase = new CMathContent(1, 1);
oBase.init( this.params ); oBase.init( this.params );
...@@ -217,7 +745,7 @@ CDegreeRadical.prototype.setContent = function() ...@@ -217,7 +745,7 @@ CDegreeRadical.prototype.setContent = function()
CDegreeOrdinary.superclass.setContent.call(this, oDegree, oBase); CDegreeOrdinary.superclass.setContent.call(this, oDegree, oBase);
} }
CDegreeRadical.prototype.recalculateSize = function() old_CDegreeRadical.prototype.recalculateSize = function()
{ {
var degr = this.elements[0][0].size, var degr = this.elements[0][0].size,
base = this.elements[0][1].size; base = this.elements[0][1].size;
...@@ -248,7 +776,7 @@ CDegreeRadical.prototype.recalculateSize = function() ...@@ -248,7 +776,7 @@ CDegreeRadical.prototype.recalculateSize = function()
// высота значка радикала // высота значка радикала
var heightRadical = getStateHeight_3(base.height + top, this.params.font); var heightRadical = getHeightRadical(base.height + top, this.params.font);
heightRadical += penW; heightRadical += penW;
// высота "галки" радикала // высота "галки" радикала
...@@ -288,7 +816,7 @@ CDegreeRadical.prototype.recalculateSize = function() ...@@ -288,7 +816,7 @@ CDegreeRadical.prototype.recalculateSize = function()
this.size = {width: width, height: height, center: center}; this.size = {width: width, height: height, center: center};
} }
CDegreeRadical.prototype.setPosition = function(pos) old_CDegreeRadical.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.center};
...@@ -302,12 +830,12 @@ CDegreeRadical.prototype.setPosition = function(pos) ...@@ -302,12 +830,12 @@ CDegreeRadical.prototype.setPosition = function(pos)
this.elements[0][1].setPosition({x: x2, y: y2 }); this.elements[0][1].setPosition({x: x2, y: y2 });
} }
CDegreeRadical.prototype.draw = function() old_CDegreeRadical.prototype.draw = function()
{ {
CDegreeRadical.superclass.draw.call(this); old_CDegreeRadical.superclass.draw.call(this);
DrawingRadical.call(this); DrawingRadical.call(this);
} }
CDegreeRadical.prototype.findDisposition = function(mCoord) old_CDegreeRadical.prototype.findDisposition = function(mCoord)
{ {
var mouseCoord = {x: null, y: null}, var mouseCoord = {x: null, y: null},
posCurs = {x: 0, y: null}, posCurs = {x: 0, y: null},
...@@ -370,11 +898,11 @@ CDegreeRadical.prototype.findDisposition = function(mCoord) ...@@ -370,11 +898,11 @@ CDegreeRadical.prototype.findDisposition = function(mCoord)
return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag}; return {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
} }
CDegreeRadical.prototype.getBase = function() old_CDegreeRadical.prototype.getBase = function()
{ {
return this.elements[0][1]; return this.elements[0][1];
} }
CDegreeRadical.prototype.getDegree = function() old_CDegreeRadical.prototype.getDegree = function()
{ {
return this.elements[0][0]; return this.elements[0][0];
} }
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