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

Убрала старые функции поиска позиции и отрисовки значков N-арных операторов

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57693 954022d7-b5bf-4e40-9824-e11837661b57
parent 7d870329
......@@ -1174,34 +1174,9 @@ CAccent.prototype.draw = function(x, y, pGraphics)
this.operator.draw(x, y, pGraphics);
}
CAccent.prototype.findDisposition = function(SearchPos, Depth)
{
var base = this.elements[0][0],
align = (this.size.width - this.GapLeft - this.GapRight - base.size.width)/2;
if(SearchPos.X < align)
SearchPos.X = 0;
else if(SearchPos.X > align + base.size.width)
SearchPos.X = base.size.width;
else
SearchPos.X -= align;
var accentGap = this.size.height - base.size.height;
if(SearchPos.Y < accentGap)
{
SearchPos.Y = 0;
}
else
SearchPos.Y -= accentGap;
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth + 1);
}
CAccent.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var align = (this.size.width - this.elements[0][0].size.width)/2;
var align = (this.size.width - this.elements[0][0].size.width - this.GapLeft - this.GapRight)/2;
SearchPos.CurX += this.GapLeft + align;
......
This diff is collapsed.
......@@ -275,112 +275,6 @@ CBorderBox.prototype.setPosition = function(pos)
this.elements[0][0].setPosition(NewPos);
}
CBorderBox.prototype.old_findDisposition = function(mCoord)
{
var X = null,
Y = null,
inside_flag = -1; // остаемя в пределах данного элемента( за границы элемента не вышли )
var shX = 0, shY = 0;
if(this.Pr.hideLeft == false)
shX = this.gapBrd;
if(this.Pr.hideTop == false)
shY = this.gapBrd;
var sCont = this.elements[0][0].size;
if(mCoord.x < shX)
{
X = 0;
inside_flag = 0;
}
else if(mCoord.x > shX + sCont.width)
{
X = sCont.width;
inside_flag = 1;
}
else
{
X = mCoord.x - shX;
}
if(mCoord.y < shY)
{
Y = 0;
inside_flag = 2;
}
else if(mCoord.y > shY + sCont.height)
{
Y = sCont.height;
inside_flag = 2;
}
else
{
Y = mCoord.y - shY;
}
var coord = {x: X, y: Y},
posCurs = {x: 0, y: 0};
return {pos: posCurs, mCoord: coord, inside_flag: inside_flag};
}
CBorderBox.prototype.findDisposition = function(SearchPos, Depth)
{
/*var X = null,
Y = null,
inside_flag = -1;*/ // остаемя в пределах данного элемента( за границы элемента не вышли )
var alignX = 0, alignY = 0;
if(this.Pr.hideLeft == false)
alignX = this.gapBrd;
if(this.Pr.hideTop == false)
alignY = this.gapBrd;
var base = this.elements[0][0].size;
if(SearchPos.X < alignX)
{
SearchPos.X = 0;
//inside_flag = 0;
}
else if(SearchPos.X > alignX + base.width)
{
SearchPos.X = base.width;
//inside_flag = 1;
}
else
{
SearchPos.X -= alignX;
}
if(SearchPos.Y < alignY)
{
SearchPos.Y = 0;
//inside_flag = 2;
}
else if(SearchPos.Y > alignY + base.height)
{
SearchPos.Y = base.height;
//inside_flag = 2;
}
else
{
SearchPos.Y -= alignY;
}
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
/*var coord = {x: X, y: Y},
posCurs = {x: 0, y: 0};*/
//return {pos: posCurs, mCoord: coord, inside_flag: inside_flag};
}
CBorderBox.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var alignLeft = this.Pr.hideLeft ? 0 : this.gapBrd,
......@@ -395,7 +289,7 @@ CBorderBox.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin
SearchPos.Pos.Update(0, Depth + 1);
}
SearchPos.CurX += alignRight;
SearchPos.CurX += this.GapRight + alignRight;
return result;
}
......
......@@ -258,120 +258,6 @@ CDegree.prototype.setPosition = function(pos)
this.elements[0][0].setPosition(PosBase);
this.elements[0][1].setPosition(PosIter);
}
CDegree.prototype.old_findDisposition = function(mCoord)
{
var coordX, coordY;
var X, Y;
var inside_flag = -1;
if( mCoord.x < this.elements[0][0].size.width)
{
if( this.elements[0][0].IsJustDraw() )
{
X = 0; Y = 1; // встаем во второй элемент
coordX = 0;
coordY = mCoord.y - this.upIter;
inside_flag = 0;
}
else
{
X = 0; Y = 0; // встаем в первый элемент
coordX = mCoord.x;
coordY = mCoord.y - this.upBase;
}
}
else if(mCoord.x < (this.elements[0][0].size.width + this.dW ))
{
X = 0; Y = 1; // встаем во второй элемент
coordX = 0;
coordY = mCoord.y - this.upIter;
inside_flag = 0;
}
else if(mCoord.x > this.size.width)
{
X = 0; Y = 1; // встаем во второй элемент
coordX = this.size.width;
coordY = mCoord.y - this.upIter;
inside_flag = 1;
}
else
{
X = 0; Y = 1; // встаем во второй элемент
coordX = mCoord.x - (this.elements[0][0].size.width + this.dW);
coordY = mCoord.y - this.upIter;
}
if(coordY < 0)
{
coordY = 0;
inside_flag = 2;
}
else if(coordY > this.elements[X][Y].size.height)
{
coordY = this.elements[X][Y].size.height;
inside_flag = 2;
}
var mCoord = {x: coordX, y: coordY};
return {pos: {x: X, y: Y}, mCoord: mCoord, inside_flag: inside_flag};
}
CDegree.prototype.findDisposition = function(SearchPos, Depth)
{
var base = this.elements[0][0];
var Curr_Pos_X = 0,
Curr_Pos_Y = SearchPos.Pos.Get(Depth+1);
if( SearchPos.X < base.size.width)
{
if( base.IsJustDraw() )
{
Curr_Pos_Y = 1; // позиция итератора
SearchPos.X = 0;
}
else
{
Curr_Pos_Y = 0; // позиция основания
}
}
else if(SearchPos.X < (base.size.width + this.dW ))
{
Curr_Pos_Y = 1; // позиция итератора
SearchPos.X = 0;
}
else if(SearchPos.X > this.size.width)
{
Curr_Pos_Y = 1;
SearchPos.X = this.size.width;
}
else
{
Curr_Pos_Y = 1;
SearchPos.X -= base.size.width + this.dW;
}
var alignY = 0;
if(Curr_Pos_Y == 0)
alignY = this.upBase;
else
alignY = this.upIter;
if(SearchPos.Y < alignY)
SearchPos.Y = 0;
else if(SearchPos.Y > alignY + this.elements[Curr_Pos_X][Curr_Pos_Y].size.height)
SearchPos.Y = this.elements[Curr_Pos_X][Curr_Pos_Y].size.height;
else
SearchPos.Y -= alignY;
SearchPos.Pos.Update(Curr_Pos_X, Depth);
SearchPos.Pos.Update(Curr_Pos_Y, Depth+1);
}
CDegree.prototype.getIterator = function()
{
return this.elements[0][1];
......
......@@ -212,28 +212,6 @@ CFraction.prototype.getDenominator = function()
return denominator;
}
/*CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
this.Parent = Parent;
this.ParaMath = ParaMath;
if(RPI.inline == true && this.Pr.type == BAR_FRACTION)
{
var ArgNum = ArgSize.Copy();
ArgNum.decrease();
this.elements[0][0].Resize(oMeasure, this, ParaMath, RPI, ArgNum);
var ArgDen = ArgSize.Copy();
ArgDen.decrease();
this.elements[1][0].Resize(oMeasure, this, ParaMath, RPI, ArgDen);
this.recalculateSize(oMeasure);
}
else
CFraction.superclass.Resize.call(this, oMeasure, Parent, ParaMath, RPI, ArgSize);
}*/
CFraction.prototype.Resize = function(oMeasure, Parent, ParaMath, RPI, ArgSize)
{
var ArgSzFr = ArgSize.Copy();
......@@ -358,130 +336,6 @@ CFraction.prototype.setPosition = function(pos)
else
CFraction.superclass.setPosition.call(this, pos);
}
CFraction.prototype.old_findDisposition = function(mCoord)
{
var disposition;
if(this.Pr.type == SKEWED_FRACTION)
{
var mouseCoord = {x: mCoord.x, y: mCoord.y},
posCurs = {x: null, y: null},
inside_flag = -1;
posCurs.x = 0;
if( mCoord.x < (this.elements[0][0].size.width + this.gapSlash/2))
{
var sizeFirst = this.elements[0][0].size;
if(sizeFirst.width < mCoord.x)
{
mouseCoord.x = sizeFirst.width;
inside_flag = 1;
}
if(sizeFirst.height < mCoord.y)
{
mouseCoord.y = sizeFirst.height;
inside_flag = 2;
}
posCurs.y = 0;
}
else
{
var sizeSec = this.elements[0][1].size;
if(mCoord.x < this.size.width - sizeSec.width)
{
mouseCoord.x = 0;
inside_flag = 0;
}
else if( mCoord.x > this.size.width)
{
mouseCoord.x = sizeSec.width;
inside_flag = 1;
}
else
mouseCoord.x = mCoord.x - this.elements[0][0].size.width - this.gapSlash;
if( mCoord.y < this.size.height - this.elements[0][1].size.height)
{
mouseCoord.y = 0;
inside_flag = 2;
}
else if(mCoord.y > this.size.height)
{
mouseCoord.y = sizeSec.height;
inside_flag = 2;
}
else
mouseCoord.y = mCoord.y - this.elements[0][0].size.height;
posCurs.y = 1;
}
disposition = {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
else
disposition = CFraction.superclass.findDisposition.call(this, mCoord);
return disposition;
}
CFraction.prototype.findDisposition = function(SearchPos, Depth)
{
if(this.Pr.type == SKEWED_FRACTION)
{
var Numerator = this.elements[0][0].size,
Denominator = this.elements[0][1].size;
//posCurs.x = 0;
SearchPos.Pos.Update(0, Depth);
if( SearchPos.X < (Numerator.width + this.gapSlash/2))
{
if(Numerator.width < SearchPos.X)
{
SearchPos.X = Numerator.width;
}
if(Numerator.height < SearchPos.Y)
{
SearchPos.Y = Numerator.height;
}
SearchPos.Pos.Update(0, Depth+1);
//posCurs.y = 0;
}
else
{
if(SearchPos.X < this.size.width - Denominator.width)
{
SearchPos.X = 0;
}
else if(SearchPos.X > this.size.width)
{
SearchPos.X = Denominator.width;
}
else
SearchPos.X -= Numerator.width - this.gapSlash;
if( SearchPos.Y < this.size.height - Denominator.height)
{
SearchPos.Y = 0;
}
else if(SearchPos.Y > this.size.height)
{
SearchPos.Y = Denominator.height;
}
else
SearchPos.Y -= Numerator.height;
SearchPos.Pos.Update(1, Depth+1);
//posCurs.y = 1;
}
}
else
CFraction.superclass.findDisposition.call(this, SearchPos, Depth);
}
CFraction.prototype.setProperties = function(props)
{
var bBar = props.type === BAR_FRACTION || props.type === NO_BAR_FRACTION,
......@@ -636,18 +490,6 @@ CNumerator.prototype.recalculateSize = function()
this.size = {width : width, height: height, ascent: ascent};
}
CNumerator.prototype.findDisposition = function(SearchPos, Depth)
{
var arg = this.elements[0][0].size;
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
if(SearchPos.Y > arg.height)
SearchPos.Y = arg.height;
}
CNumerator.prototype.setPosition = function(pos)
{
this.elements[0][0].setPosition(pos);
......@@ -705,26 +547,6 @@ CDenominator.prototype.recalculateSize = function()
this.size = {width : width, height: height, ascent: ascent};
}
CDenominator.prototype.findDisposition = function(SearchPos, Depth)
{
var arg = this.elements[0][0].size;
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
if(SearchPos.Y < this.gap)
{
SearchPos.Y = 0;
}
else if (SearchPos.Y > arg.height + this.gap)
{
SearchPos.Y = arg.height;
}
else
SearchPos.Y -= this.gap;
}
CDenominator.prototype.setPosition = function(pos)
{
var NewPos = new CMathPosition();
......
......@@ -4014,29 +4014,6 @@ CMathContent.prototype =
return result;
},
findDisposition: function(SearchPos, Depth)
{
var W = 0;
var pos = 0;
for(var i = 0; i < this.content.length && SearchPos.X > W; i++)
{
W += this.content[i].size.width;
pos = i;
}
if( this.content[pos].Type === para_Math_Composition )
{
if(SearchPos.X < W - this.content[pos].size.width + this.content[pos].GapLeft)
pos--;
else if(SearchPos.X >= W - this.content[pos].GapRight)
pos++;
}
SearchPos.Pos.Update(pos, Depth);
SearchPos.X -= this.WidthToElement[pos];
//return pos;
},
setPlaceholderAfterRemove: function() // чтобы не выставлялся тагет при вставке, когда заселекчен весь контент и мы добавляем, например, другой мат элемент
{
if(this.content.length == 1 && !this.bRoot )//только CEmpty
......@@ -4553,34 +4530,6 @@ CMathContent.prototype =
},
/// функции для работы с курсором
old_Get_ParaContentPosByXY: function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
if(this.content.length > 0) // случай , если у нас контент не заполнен, не предусмотрен
{
this.findDisposition(SearchPos, Depth);
var pos = SearchPos.Pos.Get(Depth);
//var pos = this.findPosition(SearchPos.X, SearchPos.Y);
//SearchPos.Pos.Update( pos, Depth );
//Depth++;
//SearchPos.X -= this.WidthToElement[pos];
if(this.content[pos].Type == para_Math_Composition)
{
SearchPos.Y -= this.size.ascent - this.content[pos].size.ascent;
this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd);
}
else if(this.content[pos].Type == para_Math_Run) // проверка на gaps в findDisposition
{
SearchPos.X += this.pos.x + this.ParaMath.X + this.WidthToElement[pos];
SearchPos.X += this.pos.x + this.WidthToElement[pos];
this.content[pos].Get_ParaContentPosByXY(SearchPos, Depth+1, _CurLine, _CurRange, StepEnd);
}
}
},
Get_ParaContentPosByXY: function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var result = false;
......
......@@ -300,71 +300,6 @@ CMathMatrix.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLi
return result;
}
CMathMatrix.prototype.findDisposition = function(SearchPos, Depth)
{
var maxWH = this.getWidthsHeights();
var Widths = maxWH.widths;
var Heights = maxWH.heights;
var Curr_Pos_X = this.nRow - 1, Curr_Pos_Y = this.nCol - 1;
for(var i = 0, w = 0; i < this.nCol; i++)
{
w += Widths[i] + this.gaps.column[i + 1]/2;
if(SearchPos.X < w)
{
Curr_Pos_Y = i;
break;
}
w += this.gaps.column[i + 1]/2;
}
SearchPos.Pos.Update(Curr_Pos_Y, Depth+1);
for(var j = 0, h = 0; j < this.nRow; j++)
{
h += Heights[j] + this.gaps.row[j + 1]/2;
if(SearchPos.Y < h)
{
Curr_Pos_X = j;
break;
}
h += this.gaps.row[j + 1]/2;
}
SearchPos.Pos.Update(Curr_Pos_X, Depth);
////////////////////////////////
var sumWidth = 0;
var sumHeight = 0;
for(var t = 0; t < Curr_Pos_Y; t++)
sumWidth += Widths[t] + this.gaps.column[t + 1];
for(t = 0; t < Curr_Pos_X; t++)
sumHeight += Heights[t] + this.gaps.row[t + 1];
if( Curr_Pos_X != null && Curr_Pos_Y != null)
{
var size = this.elements[Curr_Pos_X][Curr_Pos_Y].size;
var align = this.align(Curr_Pos_X, Curr_Pos_Y);
if(SearchPos.X < ( sumWidth + align.x ))
SearchPos.X = 0;
else if( SearchPos.X > (sumWidth + align.x + size.width ))
SearchPos.X = size.width;
else
SearchPos.X -= ( sumWidth + align.x );
if(SearchPos.Y < (sumHeight + align.y))
SearchPos.Y = 0;
else if( SearchPos.Y > ( sumHeight + align.y + size.height ) )
SearchPos.Y = size.height;
else
SearchPos.Y -= ( sumHeight + align.y );
}
}
CMathMatrix.prototype.getMetrics = function()
{
var Ascents = [];
......
This diff is collapsed.
......@@ -3780,62 +3780,6 @@ CDelimiter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLin
return result;
}
CDelimiter.prototype.findDisposition = function(SearchPos, Depth)
{
var begWidth = this.begOper.size.width,
sepWidth = this.sepOper.size.width,
endWidth = this.endOper.size.width;
SearchPos.Pos.Update(0, Depth);
var Curr_Pos_Y;
if(SearchPos.X < begWidth)
{
Curr_Pos_Y = 0;
SearchPos.X = 0;
}
else if(SearchPos.X > this.size.width - endWidth)
{
Curr_Pos_Y = 0;
SearchPos.X = this.elements[0][this.nCol - 1].size.width;
}
else
{
var ww = begWidth;
Curr_Pos_Y = this.nCol - 1;
for(var j = 0; j < this.nCol; j++)
{
if(ww + this.elements[0][j].size.width + this.sepOper.size.width/2 > SearchPos.X)
{
Curr_Pos_Y = j;
if( SearchPos.X < ww + this.elements[0][j].size.width)
SearchPos.X -= ww;
else
SearchPos.X = ww + this.elements[0][j].size.width;
break;
}
ww += this.elements[0][j].size.width + sepWidth;
}
}
SearchPos.Pos.Update(Curr_Pos_Y, Depth+1);
var align = this.align(this.elements[0][Curr_Pos_Y]);
if(align > SearchPos.Y)
SearchPos.Y = 0;
else if(this.elements[0][Curr_Pos_Y].size.height + align < SearchPos.Y)
SearchPos.Y = this.elements[0][Curr_Pos_Y].size.height;
else
SearchPos.Y -= align;
}
CDelimiter.prototype.draw = function(x, y, pGraphics)
{
......@@ -4076,35 +4020,6 @@ CCharacter.prototype.draw = function(x, y, pGraphics)
this.operator.draw(x, y, pGraphics);
}
CCharacter.prototype.findDisposition = function(SearchPos, Depth)
{
var base = this.elements[0][0],
align = this.align(base);
if(SearchPos.X < align)
SearchPos.X = 0;
else if(SearchPos.X > align + base.size.width)
SearchPos.X = base.size.width;
else
SearchPos.X -= align;
if(this.Pr.pos === LOCATION_TOP)
{
if(SearchPos.Y < this.operator.size.height)
SearchPos.Y = 0;
else
SearchPos.Y -= this.operator.size.height;
}
else if(this.Pr.pos === LOCATION_BOT)
{
if(SearchPos.Y > base.size.height)
SearchPos.Y = base.size.height;
}
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
}
CCharacter.prototype.getBase = function()
{
......
......@@ -1179,90 +1179,6 @@ CRadical.prototype.setPosition = function(pos)
this.RealBase.setPosition(PosBase);
}
}
CRadical.prototype.findDisposition = function(SearchPos, Depth)
{
//var disposition;
//var inside_flag = -1;
var base, degree;
if(this.Pr.type == SQUARE_RADICAL)
{
base = this.elements[0][0].size;
//var X, Y;
var gapLeft = this.size.width - base.width - this.GapRight;
var gapTop = this.size.ascent - base.ascent;
if(SearchPos.X < gapLeft)
SearchPos.X = 0;
else if(SearchPos.X > gapLeft + base.width)
SearchPos.X = base.width;
else
SearchPos.X -= gapLeft;
if(SearchPos.Y < gapTop)
SearchPos.Y = 0;
else if(SearchPos.Y > gapTop + base.height)
SearchPos.Y = base.height;
else
SearchPos.Y -= gapTop;
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
}
else if(this.Pr.type == DEGREE_RADICAL)
{
//var mouseCoord = {x: null, y: null},
// posCurs = {x: 0, y: null};
degree = this.elements[0][0].size;
base = this.elements[0][1].size;
SearchPos.Pos.Update(0, Depth);
if(SearchPos.X < this.size.width - base.width)
{
//posCurs.y = 0;
SearchPos.Pos.Update(0, Depth+1);
if(SearchPos.X > degree.width)
SearchPos.X = degree.width;
else if(SearchPos.X < this.gapWidth)
SearchPos.X = 0;
else
SearchPos.X -= this.gapWidth;
if(SearchPos.Y < this.gapDegree)
SearchPos.Y = 0;
else if(SearchPos.Y > degree.height + this.gapDegree)
SearchPos.Y = degree.height;
else
SearchPos.Y -= this.gapDegree;
}
else
{
//posCurs.y = 1;
SearchPos.Pos.Update(1, Depth+1);
SearchPos.X -= (this.size.width - base.width - this.GapRight);
var topBase = this.size.ascent - base.ascent;
if(SearchPos.Y < topBase)
SearchPos.Y = 0;
else if(SearchPos.Y > base.height + topBase)
SearchPos.Y = base.height;
else
SearchPos.Y -= topBase;
}
//disposition = {pos: posCurs, mCoord: mouseCoord, inside_flag: inside_flag};
}
//return disposition;
}
CRadical.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var result = false;
......@@ -1296,7 +1212,6 @@ CRadical.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine,
result = true;
}
SearchPos.CurX += this.GapRight;
}
......
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