Commit 5da5e3c4 authored by Anna.Pavlova's avatar Anna.Pavlova

1. Реализовала функцию для получения заселекченного контета и позиций селекта в этом контенте

2. Переделала селект

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55391 954022d7-b5bf-4e40-9824-e11837661b57
parent 416b87c5
......@@ -238,6 +238,11 @@ ParaMath.prototype =
return this.Math.Remove(Direction, bOnAddText);
},
GetSelectContent: function()
{
return this.Root.GetSelectContent();
},
Get_CurrentParaPos : function()
{
//var CurPos = this.State.ContentPos;
......@@ -804,8 +809,6 @@ ParaMath.prototype =
SearchPos.DiffX = Diff;
//console.log("SearchPos.X : " + SearchPos.X);
//console.log("SearchPos.Y : " + SearchPos.Y);
this.Root.Get_ParaContentPosByXY(SearchPos, Depth);
SearchPos.X = X;
......@@ -960,13 +963,38 @@ ParaMath.prototype =
var SelectH = SelectionDraw.H,
SelectStartY = SelectionDraw.StartY;
this.Root.Selection_DrawRange(SelectionDraw);
//this.Root.Selection_DrawRange(SelectionDraw);
var result = this.GetSelectContent();
if(this.Root.selectUse())
var Start = result.Start,
End = result.End,
oCont = result.Content;
SelectionDraw.StartX += oCont.pos.x + oCont.WidthToElement[Start];
//SelectionDraw.StartY = oCont.pos.y + oCont.Composition.absPos.y;
SelectionDraw.StartY += oCont.pos.y;
if(Start == End)
oCont.content[Start].Selection_DrawRange(0, 0, SelectionDraw);
else
{
oCont.content[Start].Selection_DrawRange(0, 0, SelectionDraw);
//SelectionDraw.FindStart = false;
SelectionDraw.W += oCont.WidthToElement[End] - oCont.WidthToElement[Start + 1]; // startPos < endPos !
oCont.content[End].Selection_DrawRange(0,0, SelectionDraw);
}
SelectionDraw.H = oCont.size.height;
/*if(this.Root.selectUse())
{
SelectionDraw.H = SelectH;
SelectionDraw.StartY = SelectStartY;
}
}*/
}
else
......
......@@ -1348,24 +1348,6 @@ CMathBase.prototype =
this.SelectEnd_Y = endY;
var str = "";
if(this.constructor.name == "CFraction")
{
if(startX == 0 && startY == 0)
str += "StartContentPos = Numerator; ";
else
str += "StartContentPos = Denominator; ";
if(endX == 0 && endY == 0)
str += "EndContentPos = Numerator ";
else
str += "EndContentPos = Denominator ";
console.log(str);
}
Depth += 2;
var bJustDraw = this.elements[startX][startY].IsJustDraw();
......@@ -1380,11 +1362,11 @@ CMathBase.prototype =
}
},
Selection_DrawRange: function(SelectionDraw)
/*Selection_DrawRange: function(SelectionDraw)
{
if(this.IsSelectEmpty())
this.elements[this.SelectStart_X][this.SelectStart_Y].Selection_DrawRange(SelectionDraw);
},
},*/
Selection_IsEmpty: function()
{
var result = false;
......@@ -1401,7 +1383,17 @@ CMathBase.prototype =
Recalculate_CurPos: function(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{
return this.elements[this.CurPos_X][this.CurPos_Y].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
},
GetSelectContent: function()
{
return this.elements[this.SelectStart_X][this.SelectStart_Y].GetSelectContent();
},
Selection_DrawRange: function(CurLine, CurPage, SelectionDraw) // первые два параметра нужны только для аналогичной функции в ParaRun
{
SelectionDraw.W += this.size.width;
SelectionDraw.FindStart = false;
}
//////////////////////////
}
......@@ -7593,7 +7593,6 @@ CMathContent.prototype =
{
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, 1);
//случай с плейсхолдером рассмотрели выше
if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, -1, EndFlag);
}
......@@ -7601,7 +7600,6 @@ CMathContent.prototype =
{
this.content[posStart].Set_SelectionContentPos(StartContentPos, null, Depth, StartFlag, -1);
//случай с плейсхолдером рассмотрели выше
if(this.content[posEnd].typeObj == MATH_PARA_RUN)
this.content[posEnd].Set_SelectionContentPos(null, EndContentPos, Depth, 1, EndFlag);
}
......@@ -7609,7 +7607,37 @@ CMathContent.prototype =
}
},
Selection_DrawRange: function(SelectionDraw)
GetSelectContent: function()
{
var startPos = this.SelectStartPos,
endPos = this.SelectEndPos;
if(startPos > endPos)
{
var temp = startPos;
startPos = endPos;
endPos = temp;
}
var bEqual = startPos == endPos,
bNotSelectComp = bEqual ? this.content[startPos].typeObj === MATH_COMP && this.content[startPos].IsSelectEmpty() : false;
var result;
if(bNotSelectComp)
{
result = this.content[startPos].GetSelectContent(); // startPos == endPos
}
else
{
result = {Content: this, Start: startPos, End: endPos};
}
return result;
},
//Selection_DrawRange: function(CurLine, CurPage, SelectionDraw)
OLD_Selection_DrawRange: function(SelectionDraw)
{
if(this.SelectStartPos !== this.SelectEndPos)
{
......@@ -7638,12 +7666,12 @@ CMathContent.prototype =
SelectionDraw.W += this.WidthToElement[endPos] - this.WidthToElement[startPos + 1]; // startPos < endPos
SelectionDraw.FindStart = false;
if(this.content[endPos].typeObj === MATH_PARA_RUN)
{
var StartX = SelectionDraw.StartX;
this.content[endPos].Selection_DrawRange(0, 0, SelectionDraw);
SelectionDraw.StartX = StartX;
}
else
SelectionDraw.W += this.content[endPos].size.width;
......
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