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

CMathPosition для всех классов (вместе с багом на позицию)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56480 954022d7-b5bf-4e40-9824-e11837661b57
parent d2302860
......@@ -521,7 +521,8 @@ function CAccent(props)
//this.code = null; // храним код буквы и тип здесь
//this.typeOper = null; // т.к в класах, которые вызываем, не учитываем случаи, когда элементы (стрелки/скобки) переворачиваются
CMathBase.call(this);
CAccent.superclass.constructor.call(this);
//CMathBase.call(this);
if(props !== null && typeof(props) !== "undefined")
this.init(props);
......@@ -1105,10 +1106,6 @@ CAccent.prototype.setPosition = function(pos)
this.elements[0][0].setPosition(PosBase);
}
CAccent.prototype.getAscent = function()
{
return this.operator.size.height + this.elements[0][0].size.ascent;
}
CAccent.prototype.getPropsForWrite = function()
{
var props = {};
......@@ -1164,7 +1161,7 @@ CAccent.prototype.Resize = function(Parent, ParaMath, oMeasure)
var width = base.size.width > this.operator.size.width ? base.size.width : this.operator.size.width,
height = base.size.height + this.operator.size.height + this.shiftX,
ascent = this.getAscent(oMeasure);
ascent = this.operator.size.height + this.elements[0][0].size.ascent;
this.size = {height: height, width: width, ascent: ascent};
}
......
......@@ -426,7 +426,7 @@ var inherit = function(obj, extObj)
arguments.callee(obj, arguments[a]);
else
for(var i in extObj)
if( ! obj[i])
if (!obj[i])
obj[i] = extObj[i];
return obj;
......
var CENTER = -1;
function CMathBase()
{
this.typeObj = MATH_COMP;
// {align: {height: alpha, width: betta}} alpha & betta коэффициенты в интервале от 0 до 1, либо CENTER
CENTER = -1;
this.pos = new CMathPosition();
this.size = null;
......@@ -330,6 +329,7 @@ CMathBase.prototype =
break;
}
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() )
;
//из цикла вышли если bJustDraw = false or bUpperLevel = true
......@@ -367,6 +367,7 @@ CMathBase.prototype =
break;
}
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() )
;
var content;
if( bUpperLevel )
......@@ -389,15 +390,11 @@ CMathBase.prototype =
},
select_moveRight: function()
{
var res = this.elements[this.CurPos_X][this.CurPos_Y].select_moveRight();
return res;
return this.elements[this.CurPos_X][this.CurPos_Y].select_moveRight();
},
select_moveLeft: function()
{
var res = this.elements[this.CurPos_X][this.CurPos_Y].select_moveLeft();
return res;
return this.elements[this.CurPos_X][this.CurPos_Y].select_moveLeft();
},
goToLastElement: function()
{
......@@ -684,7 +681,7 @@ CMathBase.prototype =
},
align: function(pos_x, pos_y)
{
var _x, _y;
var PosAlign = new CMathPosition();
if(this.alignment.hgt[pos_y] == CENTER)
{
......@@ -695,7 +692,7 @@ CMathBase.prototype =
var _ascent = this.elements[pos_x][j].size.ascent;
maxAsc = ( maxAsc > _ascent ) ? maxAsc : _ascent;
}
_y = (maxAsc - this.elements[pos_x][pos_y].size.ascent);
PosAlign.y = (maxAsc - this.elements[pos_x][pos_y].size.ascent);
}
else
{
......@@ -706,7 +703,7 @@ CMathBase.prototype =
_h = this.elements[pos_x][j].size.height;
maxH = ( maxH > _h ) ? maxH : _h;
}
_y = (maxH - this.elements[pos_x][pos_y].size.height)*this.alignment.hgt[pos_y];
PosAlign.y = (maxH - this.elements[pos_x][pos_y].size.height)*this.alignment.hgt[pos_y];
}
var maxW = 0;
......@@ -717,11 +714,11 @@ CMathBase.prototype =
}
if(this.alignment.wdt[pos_x] == CENTER)
_x = (maxW - this.elements[pos_x][pos_y].size.width)*0.5;
PosAlign.x = (maxW - this.elements[pos_x][pos_y].size.width)*0.5;
else
_x = (maxW - this.elements[pos_x][pos_y].size.width)*this.alignment.wdt[pos_x];
PosAlign.x = (maxW - this.elements[pos_x][pos_y].size.width)*this.alignment.wdt[pos_x];
return {x: _x, y: _y};
return PosAlign;
},
findDisposition: function(mCoord)
{
......@@ -920,25 +917,29 @@ CMathBase.prototype =
},
setPosition: function(pos)
{
this.pos.x = pos.x;
if(this.bMObjs === true)
this.pos = {x: pos.x, y : pos.y};
this.pos.y = pos.y;
else
this.pos = {x: pos.x, y: pos.y - this.size.ascent}; ///!!!!!!!!!!!!!!!!!!!!!!!!!!
this.pos.y = pos.y - this.size.ascent; ///!!!!
var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
var h = 0, w = 0;
var NewPos = new CMathPosition();
for(var i=0; i < this.nRow; i++)
{
w = 0;
for(var j = 0; j < this.nCol; j++)
{
var al = this.align(i, j);
var X = this.pos.x + this.GapLeft + al.x + this.dW*j + w;
var Y = this.pos.y + al.y + this.dH*i + h;
this.elements[i][j].setPosition( {x: X, y: Y} );
NewPos.x = this.pos.x + this.GapLeft + al.x + this.dW*j + w;
NewPos.y = this.pos.y + al.y + this.dH*i + h;
this.elements[i][j].setPosition(NewPos);
w += Widths[j];
}
h += Heights[i];
......@@ -1167,6 +1168,7 @@ CMathBase.prototype =
break;
}
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() )
;
//из цикла вышли если bJustDraw = false or bUpperLevel = true
......@@ -1202,6 +1204,7 @@ CMathBase.prototype =
break;
}
} while( this.elements[this.CurPos_X][this.CurPos_Y].IsJustDraw() )
;
var SelectContent;
if( bUpperLevel )
......@@ -1536,7 +1539,7 @@ CMathBase.prototype =
var bJDraw = this.elements[CurPos_X][CurPos_Y].IsJustDraw(),
usePlh = !bJDraw && bUseContent && this.elements[CurPos_X][CurPos_Y].IsPlaceholder();
if(!bJDraw && ! usePlh)
if(!bJDraw && !usePlh)
{
this.elements[CurPos_X][CurPos_Y].Get_RightPos(SearchPos, ContentPos, Depth + 2, bUseContent, BegRun);
SearchPos.Pos.Update(CurPos_X, Depth);
......
......@@ -384,16 +384,23 @@ CBorderBox.prototype.old_draw = function(x, y, pGraphics)
}
CBorderBox.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var x = this.pos.x + this.GapLeft, y = this.pos.y;
var NewPos = new CMathPosition();
if(this.Pr.hideLeft == false)
x += this.gapBrd;
NewPos.x = this.pos.x + this.GapLeft + this.gapBrd;
else
NewPos.x = this.pos.x + this.GapLeft;
if(this.Pr.hideTop == false)
y += this.gapBrd;
NewPos.y = this.pos.y + this.gapBrd;
else
NewPos.y = this.pos.y;
this.elements[0][0].setPosition({x : x, y: y});
this.elements[0][0].setPosition(NewPos);
}
CBorderBox.prototype.findDisposition = function(mCoord)
{
......
......@@ -227,50 +227,33 @@ CDegree.prototype.recalculateSubScript = function(oMeasure)
this.size = {width: width, height: height, ascent: ascent};
}
CDegree.prototype.old_old_setPosition = function(_pos)
CDegree.prototype.setPosition = function(pos)
{
var pos = _pos;
if(this.bMObjs === true)
{
pos = {x: pos.x, y: pos.y + this.size.center };
}
this.pos.x = pos.x;
this.elements[0][0].setPosition({x: pos.x, y: pos.y - this.elements[0][0].size.center });
this.elements[0][1].setPosition({x: pos.x + this.elements[0][0].size.width + this.dW, y: pos.y + this.shiftDegree - this.size.center});
}
CDegree.prototype.old_setPosition = function(pos)
{
if(this.bMObjs === true)
this.pos = pos;
this.pos.y = pos.y;
else
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
this.pos.y = pos.y - this.size.ascent;
var shBase = 0,
shIter = 0;
var PosBase = new CMathPosition();
if(this.upper > 0)
shBase = this.upper;
else
shIter = - this.upper;
PosBase.x = this.pos.x + this.GapLeft;
PosBase.y = this.pos.y + this.upBase;
this.elements[0][0].setPosition({x: this.pos.x, y: this.pos.y + shBase});
this.elements[0][1].setPosition({x: this.pos.x + this.elements[0][0].size.width + this.dW, y: this.pos.y + shIter});
}
CDegree.prototype.setPosition = function(pos)
{
if(this.bMObjs === true)
this.pos = pos;
else
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
var PosIter = new CMathPosition();
PosIter.x = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW;
PosIter.y = this.pos.y + this.upIter;
var x1 = this.pos.x + this.GapLeft,
y1 = this.pos.y + this.upBase;
//var x1 = this.pos.x + this.GapLeft,
// y1 = this.pos.y + this.upBase;
var x2 = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW,
y2 = this.pos.y + this.upIter;
//var x2 = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.dW,
// y2 = this.pos.y + this.upIter;
this.elements[0][0].setPosition({x: x1, y: y1});
this.elements[0][1].setPosition({x: x2, y: y2});
this.elements[0][0].setPosition(PosBase);
this.elements[0][1].setPosition(PosIter);
}
CDegree.prototype.old_findDisposition = function(mCoord)
{
......
......@@ -337,17 +337,22 @@ CFraction.prototype.setPosition = function(pos)
{
if(this.Pr.type == SKEWED_FRACTION)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var x1 = this.pos.x + this.GapLeft,
y1 = this.pos.y;
var PosNum = new CMathPosition();
var x2 = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.gapSlash,
y2 = this.pos.y + this.elements[0][0].size.height;
PosNum.x = this.pos.x + this.GapLeft;
PosNum.y = this.pos.y;
this.elements[0][0].setPosition({x: x1, y: y1});
this.elements[0][1].setPosition({x: x2, y: y2});
var PosDen = new CMathPosition();
PosDen.x = this.pos.x + this.GapLeft + this.elements[0][0].size.width + this.gapSlash;
PosDen.y = this.pos.y + this.elements[0][0].size.height;
this.elements[0][0].setPosition(PosNum);
this.elements[0][1].setPosition(PosDen);
}
else
CFraction.superclass.setPosition.call(this, pos);
......@@ -576,10 +581,7 @@ CNumerator.prototype.findDisposition = function(mCoord)
}
CNumerator.prototype.setPosition = function(pos)
{
var x = pos.x;
var y = pos.y ;
this.elements[0][0].setPosition({x: x, y: y});
this.elements[0][0].setPosition(pos);
}
CNumerator.prototype.getElement = function()
{
......@@ -651,10 +653,12 @@ CDenominator.prototype.findDisposition = function(mCoord)
}
CDenominator.prototype.setPosition = function(pos)
{
var x = pos.x;
var y = pos.y + this.gap;
var NewPos = new CMathPosition();
NewPos.x = pos.x;
NewPos.y = pos.y + this.gap;
this.elements[0][0].setPosition({x: x, y: y});
this.elements[0][0].setPosition(NewPos);
}
CDenominator.prototype.getElement = function(txt)
{
......
......@@ -527,25 +527,6 @@ CRecalculateInfo.prototype =
// TO DO
// убрать
/*function dist(_left, _right, _top, _bottom)
{
this.left = _left;
this.right = _right;
this.top = _top;
this.bottom = _bottom;
}
function mathElem(val)
{
this.value = val;
this.widthToEl = 0; // width to this element
this.gaps =
{
left: 0,
right: 0,
top: 0,
bottom: 0
}; //mm
}*/
/*function CMathRunPrp()
{
......@@ -853,10 +834,9 @@ function CMathContent()
this.CurPos = 0;
this.WidthToElement = [];
this.pos = {x:0, y:0}; // относительная позиция
this.pos = new CMathPosition(); // относительная позиция
// Properties
//this.Composition = null; // ссылка на общую формулу
this.ParaMath = null;
this.argSize = 0;
this.bDot = false;
......@@ -864,33 +844,6 @@ function CMathContent()
this.bRoot = false;
//////////////////
/*
///*/
/** real select **//*
///
this.RealSelect =
{
startPos: 0, // эти позиции идут на отрисовку селекта
endPos: 0 // и по ним удаляем элементы из контента
};
///////////////////////////////
///*/
/** logical select **//*
///
this.LogicalSelect =
{
start: 0, // логические позиции селекта !!
end: 0 // откуда начали и где закончили селект
// особенно важна стартовая позиция
};
///////////////////////////////
///////////////////////////////
*/
this.bSelectionUse = false;
this.SelectStartPos = 0;
this.SelectEndPos = 0;
......@@ -4241,7 +4194,7 @@ CMathContent.prototype =
}
else
{
if( ! this.bRoot )
if (!this.bRoot)
{
var movement = this.Parent.cursor_moveRight();
SelectContent = CurrContent = movement.SelectContent;
......@@ -4309,7 +4262,7 @@ CMathContent.prototype =
}
else
{
if( ! this.bRoot )
if(!this.bRoot)
{
var movement = this.Parent.cursor_moveRight();
SelectContent = CurrContent = movement.SelectContent;
......@@ -4328,7 +4281,7 @@ CMathContent.prototype =
{
if( this.content[this.selection.startPos - 1].value.typeObj === MATH_COMP)
{
if ( ! this.content[this.CurPos].value.select_moveRight() )
if ( !this.content[this.CurPos].value.select_moveRight() )
{
//выход за границы мат. объекта
var _active = this.selection.active;
......@@ -4671,7 +4624,7 @@ CMathContent.prototype =
x += this.content[this.CurPos].widthToEl - this.content[this.CurPos].value.size.width - this.content[this.CurPos].gaps.right;
y = 0;
if( ! this.bRoot )
if( !this.bRoot )
{
var lowLevel = this.Parent.goToLowerLevel( {x: x, y: y} );
bLow = lowLevel.bLow;
......@@ -4696,7 +4649,7 @@ CMathContent.prototype =
x += this.content[this.CurPos].widthToEl - this.content[this.CurPos].value.size.width - this.content[this.CurPos].gaps.right;
y = 0;
if( ! this.bRoot )
if( !this.bRoot )
{
var upLevel = this.Parent.goToUpperLevel( {x: x, y: y} );
bUp = upLevel.bUp;
......@@ -4754,7 +4707,7 @@ CMathContent.prototype =
var state = true,
SelectContent = null, CurrContent = null;
if( ! this.bRoot )
if( !this.bRoot )
{
var coord = {x: this.content[this.CurPos].value.size.width, y: 0};
var UpL = this.goToUpperLevel(coord);
......@@ -4775,7 +4728,7 @@ CMathContent.prototype =
var state = true,
SelectContent = null, CurrContent = null;
if( ! this.bRoot )
if( !this.bRoot )
{
var coord = {x: this.content[this.CurPos].value.size.width, y: 0};
var LowL = this.goToLowerLevel(coord);
......@@ -4856,7 +4809,7 @@ CMathContent.prototype =
var coord = this.getCoordElem(this.CurPos, msCoord );
var movement = this.content[pos].value.mouseMove(coord);
if( ! movement.state )
if( !movement.state )
{
this.setEnd_Selection( pos + 1 );
SelectContent = this;
......@@ -5536,7 +5489,7 @@ CMathContent.prototype =
var bRun = start - 1 > 0 ? this.content[start - 1].value.typeObj === MATH_RUN_PRP : false,
bNextText = start + 1 < this.content.length ? this.content[start + 1].value.typeObj == MATH_TEXT : false; // start < this.content.length - 1, значит последняя буква в контента
var bOnlyLetter = bRun && ! bNextText; // если все текстовые элементы удалили из Run, нужно удалить RunPrp
var bOnlyLetter = bRun && !bNextText; // если все текстовые элементы удалили из Run, нужно удалить RunPrp
if(bOnlyLetter)
{
......@@ -5690,7 +5643,7 @@ CMathContent.prototype =
},
setPlaceholderAfterRemove: function() // чтобы не выставлялся тагет при вставке, когда заселекчен весь контент и мы добавляем, например, другой мат элемент
{
if(this.content.length == 1 && ! this.bRoot )//только CEmpty
if(this.content.length == 1 && !this.bRoot )//только CEmpty
this.fillPlaceholders();
},
selectUse: function()
......@@ -5705,7 +5658,7 @@ CMathContent.prototype =
}
else if(this.content[this.SelectStartPos].typeObj == MATH_COMP)
{
result = ! this.content[this.SelectStartPos].IsSelectEmpty();
result = !this.content[this.SelectStartPos].IsSelectEmpty();
}
}
else
......@@ -5735,24 +5688,29 @@ CMathContent.prototype =
},
setPosition: function(pos)
{
this.pos = {x: pos.x, y: pos.y};
this.pos.x = pos.x;
this.pos.y = pos.y;
var NewPos = new CMathPosition();
NewPos.x = pos.x;
NewPos.y = pos.y + this.size.ascent; // y по baseline;
var _pos = {x: pos.x, y: pos.y + this.size.ascent}; // y по baseline;
for(var i=0; i < this.content.length; i++)
{
if(this.content[i].typeObj == MATH_COMP)
{
this.content[i].setPosition(_pos);
_pos.x += this.content[i].size.width;
this.content[i].setPosition(NewPos);
NewPos.x += this.content[i].size.width;
}
else if(this.content[i].typeObj == MATH_PARA_RUN)
{
this.content[i].Math_SetPosition(_pos);
_pos.x += this.content[i].size.width;
this.content[i].Math_SetPosition(NewPos);
NewPos.x += this.content[i].size.width;
}
else if(this.content[i].typeObj == MATH_PLACEHOLDER)
this.content[i].setPosition(_pos);
this.content[i].setPosition(NewPos);
}
},
///// properties /////
......@@ -6137,7 +6095,7 @@ CMathContent.prototype =
left = current;
}
else if(! bDeleteEmptyRun )
else if(!bDeleteEmptyRun )
{
NewContent.push(this.content[i]);
left = current;
......@@ -9066,9 +9024,7 @@ CMathContent.prototype =
items.push(oElem);
History.Add(oParent, {Type: historyitem_Math_AddItem, Items: items, Pos: Pos, PosEnd: PosEnd});
}
},
CreateFraction : function (oFraction,oParentElem,sNumText,sDenText)
{
this.CreateElem(oFraction, oParentElem);
......
......@@ -62,14 +62,14 @@ function CMathText(bJDraw)
{
this.typeObj = MATH_TEXT;
this.bJDraw = false;
this.bJDraw = bJDraw;
this.size = null;
this.value = null;
this.pos = new CMathPosition();
if(bJDraw === false || bJDraw === true)
this.bJDraw = bJDraw;
// if(bJDraw === false || bJDraw === true)
// this.bJDraw = bJDraw;
this.type = TXT_ROMAN;
......@@ -312,18 +312,28 @@ CMathText.prototype =
},
setPosition: function(pos)
{
if( ! this.bJDraw) // for text
/*try
{*/
if (!this.bJDraw) // for text
{
this.pos.x = pos.x + this.GapLeft;
this.pos.y = pos.y;
//this.pos = {x : pos.x + this.GapLeft, y: pos.y};
}
else // for symbol only drawing
{
this.pos.x = pos.x - this.rasterOffsetX;
this.pos.y = pos.y - this.rasterOffsetY;
}
/*}
catch(e)
{
this.pos.x = pos.x + this.GapLeft;
this.pos.y = pos.y;
//this.pos = {x : pos.x + this.GapLeft, y: pos.y};
}
else // for symbol only drawing
{
this.pos.x = pos.x - this.rasterOffsetX;
this.pos.y = pos.y - this.rasterOffsetY;
}
}*/
},
setCoeffTransform: function(sx, shx, shy, sy)
{
......
......@@ -269,15 +269,19 @@ CMathMatrix.prototype.recalculateSize = function(oMeasure)
}
CMathMatrix.prototype.setPosition = function(pos)
{
this.pos.x = pos.x;
if(this.bMObjs === true)
this.pos = pos;
this.pos.y = pos.y;
else
this.pos = {x: pos.x, y: pos.y - this.size.ascent}; ///!!!!!!!!!!!!!!!!!!!!!!!!!!
this.pos.y = pos.y - this.size.ascent; ///!!!!
var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
var NewPos = new CMathPosition();
var h = 0, w = 0;
for(var i=0; i < this.nRow; i++)
......@@ -286,10 +290,10 @@ CMathMatrix.prototype.setPosition = function(pos)
for(var j = 0; j < this.nCol; j++)
{
var al = this.align(i, j);
var X = this.pos.x + this.GapLeft + al.x + this.gaps.column[j] + w;
var Y = this.pos.y + al.y + this.gaps.row[i] + h;
NewPos.x = this.pos.x + this.GapLeft + al.x + this.gaps.column[j] + w;
NewPos.y = this.pos.y + al.y + this.gaps.row[i] + h;
this.elements[i][j].setPosition( {x: X, y: Y} );
this.elements[i][j].setPosition(NewPos);
w += Widths[j] + this.gaps.column[j];
}
h += Heights[i] + this.gaps.row[i];
......
......@@ -494,19 +494,37 @@ CNaryUndOvr.prototype.recalculateSize = function()
}
CNaryUndOvr.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y : pos.y - this.size.ascent};
var xx = pos.x + this.GapLeft;
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var x1 = xx + this.align(0, 0).x,
var PosUpIter = new CMathPosition();
PosUpIter.x = pos.x + this.GapLeft + this.align(0, 0).x;
PosUpIter.y = pos.y;
var PosSign = new CMathPosition();
PosSign.x = pos.x + this.GapLeft + this.align(1,0).x;
PosSign.y = pos.y + this.elements[0][0].size.height + this.gapTop;
var PosLowIter = new CMathPosition();
PosLowIter.x = pos.x + this.GapLeft + this.align(2,0).x;
PosLowIter.y = PosSign.y + this.elements[1][0].size.height + this.gapBottom;
/*var x1 = pos.x + this.GapLeft + this.align(0, 0).x,
y1 = pos.y,
x2 = xx + this.align(1,0).x,
x2 = pos.x + this.GapLeft + this.align(1,0).x,
y2 = y1 + this.elements[0][0].size.height + this.gapTop,
x3 = xx + this.align(2,0).x,
y3 = y2 + this.elements[1][0].size.height + this.gapBottom;
x3 = pos.x + this.GapLeft + 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});
this.elements[0][0].setPosition(PosUpIter);
this.elements[1][0].setPosition(PosSign);
this.elements[2][0].setPosition(PosLowIter);
}
CNaryUndOvr.prototype.findDisposition = function(mCoord)
{
......@@ -569,6 +587,7 @@ CNaryUndOvr.prototype.getUpperIterator = function()
function CNaryOperator(flip)
{
this.pos = new CMathPosition();
this.ParaMath = null;
this.bFlip = (flip == -1);
this.sizeGlyph = null;
......@@ -643,13 +662,10 @@ CNaryOperator.prototype.IsJustDraw = function()
{
return true;
}
/*CNaryOperator.prototype.relate = function(parent)
{
this.Parent = parent;
}*/
CNaryOperator.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x , y: pos.y};
this.pos.x = pos.x;
this.pos.y = pos.y;
}
CNaryOperator.prototype.recalculateSize = function()
{
......@@ -668,18 +684,10 @@ CNaryOperator.prototype.Resize = function(Parent, ParaMath, oMeasure)
this.recalculateSize(); //обычный пересчет, oMeasure не нужен
}
/*CNaryOperator.prototype.setComposition = function(Compos)
{
this.Composition = Compos;
}*/
CNaryOperator.prototype.Get_CompiledCtrPrp = function()
{
return this.Parent.Get_CompiledCtrPrp();
}
/*CNaryOperator.prototype.setReferenceComposition = function(Compos)
{
this.Composition = Compos;
}*/
CNaryOperator.prototype.IsOnlyText = function()
{
return false;
......
This diff is collapsed.
......@@ -1020,21 +1020,25 @@ CRadical.prototype.recalculateSize = function(oMeasure)
}
CRadical.prototype.setPosition = function(pos)
{
this.pos = {x: pos.x, y: pos.y - this.size.ascent};
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var PosBase = new CMathPosition(),
PosRadical = new CMathPosition();
if(this.Pr.type == SQUARE_RADICAL)
{
var gapLeft = this.size.width - this.elements[0][0].size.width;
var gapTop = this.size.ascent - this.elements[0][0].size.ascent;
var x1 = this.pos.x + this.GapLeft,
y1 = this.pos.y;
PosRadical.x = this.pos.x + this.GapLeft;
PosRadical.y = this.pos.y;
var x2 = this.pos.x + this.GapLeft + gapLeft,
y2 = this.pos.y + gapTop;
PosBase.x = this.pos.x + this.GapLeft + gapLeft;
PosBase.y = this.pos.y + gapTop;
this.signRadical.setPosition({x: x1, y: y1});
this.elements[0][0].setPosition({x: x2, y: y2});
this.signRadical.setPosition(PosRadical);
this.elements[0][0].setPosition(PosBase);
}
else if(this.Pr.type == DEGREE_RADICAL)
{
......@@ -1044,21 +1048,25 @@ CRadical.prototype.setPosition = function(pos)
var wTick = this.signRadical.measure.widthTick;
var x1 = this.pos.x + this.GapLeft + this.gapWidth,
y1 = this.pos.y + this.gapDegree;
var PosDegree = new CMathPosition();
PosDegree.x = this.pos.x + this.GapLeft + this.gapWidth;
PosDegree.y = this.pos.y + this.gapDegree;
this.elements[0][0].setPosition({x: x1, y: y1});
this.elements[0][0].setPosition(PosDegree);
var wDegree = degr.width > wTick ? degr.width - wTick : 0;
var x2 = this.pos.x + this.GapLeft + wDegree,
y2 = this.pos.y + this.size.height - sign.height;
this.signRadical.setPosition({x: x2, y: y2});
PosRadical.x = this.pos.x + this.GapLeft + wDegree;
PosRadical.y = this.pos.y + this.size.height - sign.height;
this.signRadical.setPosition(PosRadical);
PosBase.x = this.pos.x + this.GapLeft + this.size.width - base.width;
PosBase.y = this.pos.y + this.size.ascent - base.ascent;
var x3 = this.pos.x + this.GapLeft + this.size.width - base.width,
y3 = this.pos.y + this.size.ascent - base.ascent;
this.elements[0][1].setPosition({x: x3, y: y3});
this.elements[0][1].setPosition(PosBase);
}
}
CRadical.prototype.findDisposition = function(mCoord)
......
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