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

Переделала поиск позиции, Get_ParaContentPosByXY, для радикала и Characters

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@57683 954022d7-b5bf-4e40-9824-e11837661b57
parent 01483fdb
......@@ -4475,12 +4475,6 @@ CMathContent.prototype =
var currPos = 0;
if(this.bRoot)
{
console.log(TEST_STR);
TEST_STR = "";
}
while(currPos < len)
{
current = this.content[currPos];
......
......@@ -17,7 +17,6 @@ var DIV_CENT = 0.1386;
var StartTextElement = 0x2B1A; // Cambria Math
var TEST_STR = "";
// TODO
// убрать CMathTextPrp
......@@ -106,9 +105,6 @@ CMathText.prototype =
this.value = code;
TEST_STR += code.toString(16) + " ";
},
addTxt: function(txt)
{
......
......@@ -4010,8 +4010,8 @@ CCharacter.prototype.setPosition = function(pos)
this.pos.x = pos.x;
this.pos.y = pos.y - this.size.ascent;
var alignOp = this.align_2(this.operator),
alignCnt = this.align_2(this.elements[0][0]);
var alignOp = (this.size.width - this.operator.size.width)/2,
alignCnt = (this.size.width - this.elements[0][0].size.width)/2;
var PosOper = new CMathPosition(),
PosBase = new CMathPosition();
......@@ -4041,9 +4041,20 @@ CCharacter.prototype.setPosition = function(pos)
this.operator.setPosition(PosOper);
}
}
CCharacter.prototype.align_2 = function(element)
CCharacter.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
return (this.size.width - element.size.width)/2;
var align = (this.size.width - this.elements[0][0].size.width)/2;
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth+1);
SearchPos.CurX += this.GapLeft + align;
var result = this.elements[0][0].Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd);
SearchPos.CurX += this.GapRight + align;
return result;
}
CCharacter.prototype.draw = function(x, y, pGraphics)
{
......
......@@ -1191,7 +1191,7 @@ CRadical.prototype.findDisposition = function(SearchPos, Depth)
base = this.elements[0][0].size;
//var X, Y;
var gapLeft = this.size.width - base.width;
var gapLeft = this.size.width - base.width - this.GapRight;
var gapTop = this.size.ascent - base.ascent;
if(SearchPos.X < gapLeft)
......@@ -1247,7 +1247,7 @@ CRadical.prototype.findDisposition = function(SearchPos, Depth)
//posCurs.y = 1;
SearchPos.Pos.Update(1, Depth+1);
SearchPos.X -= (this.size.width - base.width);
SearchPos.X -= (this.size.width - base.width - this.GapRight);
var topBase = this.size.ascent - base.ascent;
if(SearchPos.Y < topBase)
......@@ -1263,6 +1263,45 @@ CRadical.prototype.findDisposition = function(SearchPos, Depth)
//return disposition;
}
CRadical.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var result = false;
if(this.Pr.type == SQUARE_RADICAL)
{
SearchPos.CurX += this.size.width - this.Base.size.width - this.GapRight;
if(this.Base.Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth + 1);
result = true;
}
SearchPos.CurX += this.GapRight;
}
else
{
SearchPos.CurX += this.GapLeft;
if(this.Iterator.Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(0, Depth + 1);
result = true;
}
SearchPos.CurX += this.size.width - this.Iterator.size.width - this.Base.size.width - this.GapRight;
if(this.Base.Get_ParaContentPosByXY(SearchPos, Depth+2, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update(0, Depth);
SearchPos.Pos.Update(1, Depth + 1);
result = true;
}
SearchPos.CurX += this.GapRight;
}
return result;
}
CRadical.prototype.draw = function(x, y, pGraphics)
{
////// test //////
......
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