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

integral

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@48086 954022d7-b5bf-4e40-9824-e11837661b57
parent 63fa1fe9
...@@ -91,6 +91,13 @@ CMathBase.prototype = ...@@ -91,6 +91,13 @@ CMathBase.prototype =
setComposition: function(Compos) setComposition: function(Compos)
{ {
this.Composition = Compos; this.Composition = Compos;
for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++)
{
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].setComposition(Compos);
}
}, },
setTxtPr: function(prp) setTxtPr: function(prp)
{ {
...@@ -100,6 +107,7 @@ CMathBase.prototype = ...@@ -100,6 +107,7 @@ CMathBase.prototype =
{ {
for(var i=0; i < this.nRow; i++) for(var i=0; i < this.nRow; i++)
for(var j = 0; j < this.nCol; j++) for(var j = 0; j < this.nCol; j++)
if(!this.elements[i][j].IsJustDraw())
this.elements[i][j].fillPlaceholders(); this.elements[i][j].fillPlaceholders();
}, },
setReduct: function(coeff) setReduct: function(coeff)
...@@ -702,7 +710,7 @@ CMathBase.prototype = ...@@ -702,7 +710,7 @@ CMathBase.prototype =
setPosition: function(pos) setPosition: function(pos)
{ {
if(this.bMObjs === true) if(this.bMObjs === true)
this.pos = pos; this.pos = {x: pos.x, y : pos.y};
else else
this.pos = {x: pos.x, y: pos.y - this.size.center}; ///!!!!!!!!!!!!!!!!!!!!!!!!!! this.pos = {x: pos.x, y: pos.y - this.size.center}; ///!!!!!!!!!!!!!!!!!!!!!!!!!!
...@@ -740,6 +748,8 @@ CMathBase.prototype = ...@@ -740,6 +748,8 @@ CMathBase.prototype =
var maxWH = this.getWidthsHeights(); var maxWH = this.getWidthsHeights();
this.setDistance();
var Widths = maxWH.widths; var Widths = maxWH.widths;
var Heights = maxWH.heights; var Heights = maxWH.heights;
......
...@@ -7,12 +7,9 @@ extend(CBarFraction, CMathBase); ...@@ -7,12 +7,9 @@ extend(CBarFraction, CMathBase);
CBarFraction.prototype.init = function() CBarFraction.prototype.init = function()
{ {
var num = new CNumerator(); var num = new CNumerator();
num.setComposition(this.Composition);
num.init(); num.init();
var den = new CDenominator(); var den = new CDenominator();
den.setComposition(this.Composition);
den.init(); den.init();
this.setDimension(2, 1); this.setDimension(2, 1);
......
...@@ -202,6 +202,9 @@ CMathContent.prototype = ...@@ -202,6 +202,9 @@ CMathContent.prototype =
case 7: case 7:
mathElem = new CDegreeRadical(); mathElem = new CDegreeRadical();
break; break;
case 8:
mathElem = new CNary();
break;
} }
if( mathElem !== null ) if( mathElem !== null )
...@@ -430,7 +433,26 @@ CMathContent.prototype = ...@@ -430,7 +433,26 @@ CMathContent.prototype =
iter2.addTxt("2"); iter2.addTxt("2");
break; break;
case 23:
var integr = this.createMComponent(8);
integr.init(0,0,0);
integr.fillPlaceholders();
break;
case 25:
var integr = this.createMComponent(8);
integr.init(0,0,3);
integr.fillPlaceholders();
break;
/*case 24:
var integr = this.createMComponent(8);
integr.init(0,0,1);
integr.fillPlaceholders();
break;
case 26:
var integr = this.createMComponent(8);
integr.init(0,0,2);
integr.fillPlaceholders();
break;*/
} }
}, },
removeAreaSelect: function() removeAreaSelect: function()
......
...@@ -11,68 +11,70 @@ ...@@ -11,68 +11,70 @@
// 0 - итраторы по прямой линии // 0 - итраторы по прямой линии
// 1 - итераторы расположены также, как у степени // 1 - итераторы расположены также, как у степени
function CNary(id, OrderType, IterType )
function CNary()
{ {
CSubMathBase.call( this,1,2 ); CSubMathBase.call(this);
this.OrderType = OrderType;
this.IterType = IterType;
this.id = id;
//this.NarySymbols = [0x222B, 0x222C, 0x222D, 0x222E, 0x222F, 0x2230, 0x2211, 0x220F, 0x2210, 0x22C3, 0x22C2, 0x22C1, 0x22C0];
} }
extend(CNary,CSubMathBase); extend(CNary, CSubMathBase);
CNary.prototype.setContent = function() CNary.prototype.init = function(index, orderType, iterType)
{ {
var oBase = null, oArg = null; this.setDimension(1, 2);
//переделать здесь, т.к криво для случая когда нет опреаторов : не обрабатывается событие нажатия мыши
if(this.OrderType == 0 || this.IterType == 0)
oBase = new CBaseNaryOrder(this.id, this.IterType); // undOvr
else
oBase = new CDegree(this.IterType - 1); // вычитаем 1 т.к. параметры инициализации от 0 до 2
var arg = new CMathContent(),
base;
var sign = null; var sign = null;
if(this.id == 0) if(index == 0)
sign = new CIntegral(); sign = new CIntegral();
else if(this.id == 1) else if(index == 1)
sign = new CDoubleIntegral(); sign = new CDoubleIntegral();
else if(this.id == 2) else if(index == 2)
sign = new CTripleIntegral(); sign = new CTripleIntegral();
else if(this.id == 3) else if(index == 3)
sign = new CContourIntegral(); sign = new CContourIntegral();
else if(this.id == 4) else if(index == 4)
sign = new CSurfaceIntegral(); sign = new CSurfaceIntegral();
else if(this.id == 5) else if(index == 5)
sign = new CVolumeIntegral(); sign = new CVolumeIntegral();
else if(this.id == 6) else if(index == 6)
sign = new CSigma(); sign = new CSigma();
else if(this.id == 7) else if(index == 7)
sign = new CProduct(); sign = new CProduct();
else if(this.id == 8) else if(index == 8)
sign = new CProduct(-1); sign = new CProduct(-1);
else if(this.id == 9) else if(index == 9)
sign = new CUnion(); sign = new CUnion();
else if(this.id == 10) else if(index == 10)
sign = new CUnion(-1); sign = new CUnion(-1);
else if(this.id == 11) else if(index == 11)
sign = new CLogicalOr(1); sign = new CLogicalOr(1);
else if(this.id == 12) else if(index == 12)
sign = new CLogicalOr(-1); sign = new CLogicalOr(-1);
else
return null;
sign.init(this.params); if(orderType == 0)
{
oBase.init(this.params); if(iterType == 0)
oBase.relate(this); base = sign;
oBase.setContent(sign); else if(iterType == 1)
{
oArg = new CMathContent(); base = new CNaryUnd();
oArg.init(this.params); base.init(sign);
oArg.relate(this); }
oArg.fillPlaceholders(); else if(iterType == 2)
{
base = new CNaryOvr();
base.init(sign);
}
else if(iterType == 3)
{
base = new CNaryUndOvr();
base.init(sign);
}
}
CNary.superclass.setContent.call(this, oBase, oArg); this.addMCToContent(base, arg);
} }
CNary.prototype.getBase = function() CNary.prototype.getBase = function()
{ {
...@@ -87,114 +89,163 @@ CNary.prototype.getLowerIterator = function() ...@@ -87,114 +89,163 @@ CNary.prototype.getLowerIterator = function()
return this.elements[0][0].getLowerIterator(); return this.elements[0][0].getLowerIterator();
} }
function CBaseNaryOrder(id, IterType ) function CNaryUnd()
{ {
if(IterType == 3) CMathBase.call(this);
CMathBase.call(this, 3, 1);
else if(IterType == 2 || IterType == 1)
CMathBase.call(this, 2, 1);
else if(IterType == 0)
CMathBase.call(this, 1, 1);
this.id = id;
//this.PlaceSign = (IterType == 2 || IterType == 0) ? 0 : 1;
this.IterType = IterType;
} }
extend(CBaseNaryOrder, CMathBase); extend(CNaryUnd, CMathBase);
CBaseNaryOrder.prototype.setContent = function() CNaryUnd.prototype.init = function(sign)
{ {
var fontIter = getTypeDegree(this.params.font); this.setDimension(2,1);
var params = Common_CopyObj(this.params);
params.font = fontIter;
if(this.IterType == 1) //устанавливаем верхний индекс
{
this.elements[0][0].fillPlaceholders();
this.elements[0][0].relate(this);
this.elements[1][0] = arguments[0]; // n-арный оператор var iter = new CMathContent();
this.elements[1][0].setTopBottonGaps(true, false); iter.setReduct(DEGR_REDUCT);
} this.addMCToContent(iter, sign);
else if(this.IterType == 2) //устанавливаем нижний индекс }
{ CNaryUnd.prototype.setDistance = function()
{
this.elements[1][0].fillPlaceholders(); var zetta = this.Parent.getTxtPrp().FontSize* 25.4/96;
this.elements[1][0].relate(this); this.dH = zetta*0.25;
}
CNaryUnd.prototype.getCenter = function()
{
return this.elements[0][0].size.height + this.dW + this.elements[1][0].size.center ;
}
this.elements[0][0] = arguments[0]; // n-арный оператор
this.elements[0][0].setTopBottonGaps(false, true);
}
else if(this.IterType == 3)
{
this.elements[0][0].fillPlaceholders();
this.elements[0][0].relate(this);
this.elements[1][0] = arguments[0]; // n-арный оператор function CNaryOvr()
this.elements[1][0].setTopBottonGaps(true, true); {
CMathBase.call(this);
}
extend(CNaryOvr, CMathBase);
CNaryOvr.prototype.init = function(sign)
{
this.setDimension(2,1);
this.elements[2][0].fillPlaceholders(); var iter = new CMathContent();
this.elements[2][0].relate(this); iter.setReduct(DEGR_REDUCT);
}
else
{
this.elements[0][0] = arguments[0]; // n-арный оператор
this.elements[0][0].setTopBottonGaps(false, false);
}
this.recalculateSize(); this.addMCToContent(sign, iter);
} }
CBaseNaryOrder.prototype.getCenter = function() CNaryOvr.prototype.setDistance = function()
{ {
var center; var zetta = this.Parent.getTxtPrp().FontSize* 25.4/96;
this.dH = zetta*0.1;
if(this.IterType == 1 || this.IterType == 3) }
center = this.elements[0][0].size.height + this.elements[1][0].size.center; CNaryOvr.prototype.getCenter = function()
else {
center = this.elements[0][0].size.center; return this.elements[0][0].size.center;
}
return center; function CNaryUndOvr()
{
this.gapTop = 0;
this.gapBottom = 0;
CMathBase.call(this);
} }
CBaseNaryOrder.prototype.recalculateSize = function() extend(CNaryUndOvr, CMathBase);
CNaryUndOvr.prototype.init = function(sign)
{ {
CBaseNaryOrder.superclass.recalculateSize.call(this); this.setDimension(3,1);
var gap = this.params.font.FontSize/36*2.45; var iter1 = new CMathContent();
this.size.width += gap; iter1.setReduct(DEGR_REDUCT);
var iter2 = new CMathContent();
iter2.setReduct(DEGR_REDUCT);
this.addMCToContent(iter1, sign, iter2);
} }
CBaseNaryOrder.prototype.IsJustDraw = function() CNaryUndOvr.prototype.recalculateSize = function()
{ {
return this.IterType == 0; // если только один значок n-арного оператора var zetta = this.Parent.getTxtPrp().FontSize* 25.4/96;
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 width = 0, height = 0;
for(var i = 0; i < 3; i++)
{
width = width > this.elements[i][0].size.width ? width : this.elements[i][0].size.width;
height += this.elements[i][0].size.height;
}
height += this.gapTop + this.gapBottom;
this.size = {width: width, height: height, center: center};
} }
CBaseNaryOrder.prototype.getUpperIterator = function() CNaryUndOvr.prototype.setPosition = function(pos)
{ {
return this.elements[0][0]; this.pos = {x: pos.x, y : pos.y - this.size.center};
var x1 = pos.x + this.align(0, 0).x,
y1 = pos.y,
x2 = pos.x + this.align(1,0).x,
y2 = y1 + this.elements[0][0].size.height + this.gapTop,
x3 = pos.x + this.align(2,0).x,
y3 = y2 + this.elements[1][0].size.height + this.gapBottom;
this.elements[0][0].setPosition({x: x1, y :y1 });
this.elements[1][0].setPosition({x: x2, y :y2 });
this.elements[2][0].setPosition({x: x3, y :y3 });
} }
CBaseNaryOrder.prototype.getLowerIterator = function() CNaryUndOvr.prototype.findDisposition = function(mCoord)
{ {
var iter = null; var X = null, Y = null;
var iter, pos_x, pos_y = 0;
var inside_flag = -1;
if(this.IterType == 2) if(mCoord.y < this.size.height/2)
iter = this.elements[1][0]; {
else if(this.IterType == 3) iter = this.elements[0][0].size;
iter = this.elements[2][0]; if( mCoord.y > iter.height )
{
Y = iter.height;
inside_flag = 2;
}
else
Y = mCoord.y;
return iter; pos_x = 0;
}
else
{
iter = this.elements[2][0].size;
if( mCoord.y < iter.height )
{
Y = 0;
inside_flag = 2;
}
else
Y = mCoord.y - (this.size.height - iter.height);
pos_x = 2;
}
var align = this.align(pos_x, 0);
if(mCoord.x < align.x )
{
X = 0;
inside_flag = 0;
}
else if(mCoord.x > align.x + iter.width)
{
X = iter.width;
inside_flag = 1;
}
else
X = mCoord.x - align.x;
return {pos: {x: pos_x, y: pos_y}, mCoord: {x: X, y: Y}, inside_flag: inside_flag};
} }
function CNaryOperator(flip) function CNaryOperator(flip)
{ {
this.gap = 0;
this.bFlip = (flip == -1); this.bFlip = (flip == -1);
this.sizeGlyph = null; this.sizeGlyph = null;
this.gapTop = 0;
this.gapBotton = 0;
}
CNaryOperator.prototype.init = function(params)
{
this.params = Common_CopyObj(params);
this.recalculateSize();
} }
CNaryOperator.prototype.draw = function() CNaryOperator.prototype.draw = function()
{ {
...@@ -206,7 +257,7 @@ CNaryOperator.prototype.draw = function() ...@@ -206,7 +257,7 @@ CNaryOperator.prototype.draw = function()
var XX = new Array(), var XX = new Array(),
YY = new Array(); YY = new Array();
var textScale = this.params.font.FontSize/850; // 1000 pt var textScale = this.Parent.getTxtPrp().FontSize/850; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры
// g_dKoef_px_to_mm = 25.4/96 // g_dKoef_px_to_mm = 25.4/96
...@@ -247,35 +298,37 @@ CNaryOperator.prototype.IsJustDraw = function() ...@@ -247,35 +298,37 @@ CNaryOperator.prototype.IsJustDraw = function()
{ {
return true; return true;
} }
CNaryOperator.prototype.relate = function() CNaryOperator.prototype.relate = function(parent)
{ {
this.Parent = parent;
} }
CNaryOperator.prototype.setPosition = function(pos) CNaryOperator.prototype.setPosition = function(pos)
{ {
this.pos = {x: pos.x , y: pos.y + this.gapTop}; this.pos = {x: pos.x , y: pos.y};
} }
CNaryOperator.prototype.recalculateSize = function() CNaryOperator.prototype.recalculateSize = function()
{ {
this.sizeGlyph = this.calculateSizeGlyph(); this.sizeGlyph = this.calculateSizeGlyph();
var height = this.sizeGlyph.height + this.gapTop + this.gapBotton, var height = this.sizeGlyph.height,
width = this.sizeGlyph.width, width = this.sizeGlyph.width,
center = this.sizeGlyph.height/2 + this.gapTop; center = this.sizeGlyph.height/2;
this.size = {height: height, width: width, center: center}; this.size = {height: height, width: width, center: center};
} }
CNaryOperator.prototype.setTopBottonGaps = function(bUp, bDown) CNaryOperator.prototype.setComposition = function()
{ {
var zetta = this.params.font.FontSize* 25.4/96;
this.gapTop = bUp ? zetta*0.25 : 0; }
this.gapBotton = bDown ? zetta*0.1 : 0; CNaryOperator.prototype.setReduct = function()
{
}
CNaryOperator.prototype.Resize = function()
{
this.recalculateSize(); this.recalculateSize();
} }
function CSigma() function CSigma()
{ {
CNaryOperator.call(this); CNaryOperator.call(this);
...@@ -1080,7 +1133,7 @@ CIntegral.prototype.old_drawPath = function(XX, YY) ...@@ -1080,7 +1133,7 @@ CIntegral.prototype.old_drawPath = function(XX, YY)
} }
CIntegral.prototype.calculateSizeGlyph = function() CIntegral.prototype.calculateSizeGlyph = function()
{ {
var betta = this.params.font.FontSize/36; var betta = this.Parent.getTxtPrp().FontSize/36;
var _width = 8.624*betta, var _width = 8.624*betta,
_height = 13.7*betta; _height = 13.7*betta;
...@@ -3747,3 +3800,272 @@ CVolumeIntegral.prototype.calculateSizeGlyph = function() ...@@ -3747,3 +3800,272 @@ CVolumeIntegral.prototype.calculateSizeGlyph = function()
return {width : width, height : height}; return {width : width, height : height};
} }
function old_CNary(id, OrderType, IterType )
{
CSubMathBase.call( this,1,2 );
this.OrderType = OrderType;
this.IterType = IterType;
this.id = id;
//this.NarySymbols = [0x222B, 0x222C, 0x222D, 0x222E, 0x222F, 0x2230, 0x2211, 0x220F, 0x2210, 0x22C3, 0x22C2, 0x22C1, 0x22C0];
}
extend(old_CNary,CSubMathBase);
old_CNary.prototype.setContent = function()
{
var oBase = null, oArg = null;
//переделать здесь, т.к криво для случая когда нет опреаторов : не обрабатывается событие нажатия мыши
if(this.OrderType == 0 || this.IterType == 0)
oBase = new CBaseNaryOrder(this.id, this.IterType); // undOvr
else
oBase = new CDegree(this.IterType - 1); // вычитаем 1 т.к. параметры инициализации от 0 до 2
var sign = null;
if(this.id == 0)
sign = new CIntegral();
else if(this.id == 1)
sign = new CDoubleIntegral();
else if(this.id == 2)
sign = new CTripleIntegral();
else if(this.id == 3)
sign = new CContourIntegral();
else if(this.id == 4)
sign = new CSurfaceIntegral();
else if(this.id == 5)
sign = new CVolumeIntegral();
else if(this.id == 6)
sign = new CSigma();
else if(this.id == 7)
sign = new CProduct();
else if(this.id == 8)
sign = new CProduct(-1);
else if(this.id == 9)
sign = new CUnion();
else if(this.id == 10)
sign = new CUnion(-1);
else if(this.id == 11)
sign = new CLogicalOr(1);
else if(this.id == 12)
sign = new CLogicalOr(-1);
else
return null;
sign.init(this.params);
oBase.init(this.params);
oBase.relate(this);
oBase.setContent(sign);
oArg = new CMathContent();
oArg.init(this.params);
oArg.relate(this);
oArg.fillPlaceholders();
old_CNary.superclass.setContent.call(this, oBase, oArg);
}
old_CNary.prototype.getBase = function()
{
return this.elements[0][1];
}
old_CNary.prototype.getUpperIterator = function()
{
return this.elements[0][0].getUpperIterator();
}
old_CNary.prototype.getLowerIterator = function()
{
return this.elements[0][0].getLowerIterator();
}
function old_CBaseNaryOrder(id, IterType )
{
if(IterType == 3)
CMathBase.call(this, 3, 1);
else if(IterType == 2 || IterType == 1)
CMathBase.call(this, 2, 1);
else if(IterType == 0)
CMathBase.call(this, 1, 1);
this.id = id;
//this.PlaceSign = (IterType == 2 || IterType == 0) ? 0 : 1;
this.IterType = IterType;
}
extend(old_CBaseNaryOrder, CMathBase);
old_CBaseNaryOrder.prototype.setContent = function()
{
var fontIter = getTypeDegree(this.params.font);
var params = Common_CopyObj(this.params);
params.font = fontIter;
if(this.IterType == 1) //устанавливаем верхний индекс
{
this.elements[0][0].fillPlaceholders();
this.elements[0][0].relate(this);
this.elements[1][0] = arguments[0]; // n-арный оператор
this.elements[1][0].setTopBottonGaps(true, false);
}
else if(this.IterType == 2) //устанавливаем нижний индекс
{
this.elements[1][0].fillPlaceholders();
this.elements[1][0].relate(this);
this.elements[0][0] = arguments[0]; // n-арный оператор
this.elements[0][0].setTopBottonGaps(false, true);
}
else if(this.IterType == 3)
{
this.elements[0][0].fillPlaceholders();
this.elements[0][0].relate(this);
this.elements[1][0] = arguments[0]; // n-арный оператор
this.elements[1][0].setTopBottonGaps(true, true);
this.elements[2][0].fillPlaceholders();
this.elements[2][0].relate(this);
}
else
{
this.elements[0][0] = arguments[0]; // n-арный оператор
this.elements[0][0].setTopBottonGaps(false, false);
}
this.recalculateSize();
}
old_CBaseNaryOrder.prototype.getCenter = function()
{
var center;
if(this.IterType == 1 || this.IterType == 3)
center = this.elements[0][0].size.height + this.elements[1][0].size.center;
else
center = this.elements[0][0].size.center;
return center;
}
old_CBaseNaryOrder.prototype.recalculateSize = function()
{
old_CBaseNaryOrder.superclass.recalculateSize.call(this);
var gap = this.params.font.FontSize/36*2.45;
this.size.width += gap;
}
old_CBaseNaryOrder.prototype.IsJustDraw = function()
{
return this.IterType == 0; // если только один значок n-арного оператора
}
old_CBaseNaryOrder.prototype.getUpperIterator = function()
{
return this.elements[0][0];
}
old_CBaseNaryOrder.prototype.getLowerIterator = function()
{
var iter = null;
if(this.IterType == 2)
iter = this.elements[1][0];
else if(this.IterType == 3)
iter = this.elements[2][0];
return iter;
}
function old_CNaryOperator(flip)
{
this.gap = 0;
this.bFlip = (flip == -1);
this.sizeGlyph = null;
this.gapTop = 0;
this.gapBotton = 0;
}
old_CNaryOperator.prototype.init = function(params)
{
this.params = Common_CopyObj(params);
this.recalculateSize();
}
old_CNaryOperator.prototype.draw = function()
{
var coord = this.getCoord();
var X = coord.X,
Y = coord.Y;
var XX = new Array(),
YY = new Array();
var textScale = this.params.font.FontSize/850; // 1000 pt
var alpha = textScale*25.4/96 /64; // коэффициент; используется для того чтобы перевести координаты в миллиметры
// g_dKoef_px_to_mm = 25.4/96
var a, b;
if(this.bFlip)
{
a = -1;
b = this.sizeGlyph.height;
}
else
{
a = 1;
b = 0;
}
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);
}
var intGrid = MathControl.pGraph.GetIntegerGrid();
MathControl.pGraph.SetIntegerGrid(false);
MathControl.pGraph.p_width(1000);
MathControl.pGraph.b_color1(0,0,0, 255);
MathControl.pGraph.p_color(0,0,0, 255);
MathControl.pGraph._s();
this.drawPath(XX,YY);
MathControl.pGraph.df();
MathControl.pGraph.SetIntegerGrid(intGrid);
}
old_CNaryOperator.prototype.IsJustDraw = function()
{
return true;
}
old_CNaryOperator.prototype.relate = function()
{
}
old_CNaryOperator.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x , y: pos.y + this.gapTop};
}
old_CNaryOperator.prototype.recalculateSize = function()
{
this.sizeGlyph = this.calculateSizeGlyph();
var height = this.sizeGlyph.height + this.gapTop + this.gapBotton,
width = this.sizeGlyph.width,
center = this.sizeGlyph.height/2 + this.gapTop;
this.size = {height: height, width: width, center: center};
}
old_CNaryOperator.prototype.setTopBottonGaps = function(bUp, bDown)
{
var zetta = this.params.font.FontSize* 25.4/96;
this.gapTop = bUp ? zetta*0.25 : 0;
this.gapBotton = bDown ? zetta*0.1 : 0;
this.recalculateSize();
}
\ No newline at end of file
function CSubMathBase(countRow, countCol) function CSubMathBase()
{ {
CMathBase.call(this, countRow, countCol ); CMathBase.call(this);
} }
extend(CSubMathBase, CMathBase); extend(CSubMathBase, CMathBase);
CSubMathBase.prototype.mouseMove = function( mCoord )
{
var elem = this.findDisposition( mCoord);
var state = true,
SelectContent = null;
if(elem.pos.x == this.CurPos_X && elem.pos.y == this.CurPos_Y && elem.inside_flag === -1 )
{
movement = this.elements[this.CurPos_X][this.CurPos_Y].mouseMove(elem.mCoord);
SelectContent = movement.SelectContent;
state = movement.state;
}
else
{
state = false;
}
return {state: state, SelectContent: SelectContent};
}
/*CSubMathBase.prototype.remove = function() function old_CSubMathBase(countRow, countCol)
{ {
CMathBase.call(this, countRow, countCol );
}
extend(old_CSubMathBase, CMathBase);
/*old_CSubMathBase.prototype.remove = function()
{
var result = this.elements[this.CurPos_X][this.CurPos_Y].remove(); var result = this.elements[this.CurPos_X][this.CurPos_Y].remove();
this.recalculateSize(); this.recalculateSize();
return result; return result;
}*/ }*/
//выставим позиции каждого элемента, для того, чтобы не вычесть лишний раз "центр" объекта //выставим позиции каждого элемента, для того, чтобы не вычесть лишний раз "центр" объекта
/*CSubMathBase.prototype.setPosition = function(pos) /*old_CSubMathBase.prototype.setPosition = function(pos)
{ {
this.pos = pos; this.pos = pos;
var w = 0; var w = 0;
var h = 0; var h = 0;
...@@ -29,8 +55,8 @@ extend(CSubMathBase, CMathBase); ...@@ -29,8 +55,8 @@ extend(CSubMathBase, CMathBase);
} }
h += maxWH.heights[i]; h += maxWH.heights[i];
} }
}*/ }*/
CSubMathBase.prototype.old_mouseMove = function( mCoord ) old_CSubMathBase.prototype.old_mouseMove = function( mCoord )
{ {
var res = true; var res = true;
var elem = this.findDisposition( mCoord); var elem = this.findDisposition( mCoord);
...@@ -43,7 +69,7 @@ CSubMathBase.prototype.old_mouseMove = function( mCoord ) ...@@ -43,7 +69,7 @@ CSubMathBase.prototype.old_mouseMove = function( mCoord )
return res; return res;
} }
CSubMathBase.prototype.mouseMove = function( mCoord ) old_CSubMathBase.prototype.mouseMove = function( mCoord )
{ {
var elem = this.findDisposition( mCoord); var elem = this.findDisposition( mCoord);
var state = true, var state = true,
......
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