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

Поправила баги на селекте

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@55382 954022d7-b5bf-4e40-9824-e11837661b57
parent cf964989
...@@ -62,7 +62,7 @@ ParaMath.prototype = ...@@ -62,7 +62,7 @@ ParaMath.prototype =
Is_Empty : function() Is_Empty : function()
{ {
return this.Math.Is_Empty(); return this.Root.content.length == 0;
}, },
Is_StartFromNewLine : function() Is_StartFromNewLine : function()
...@@ -792,24 +792,32 @@ ParaMath.prototype = ...@@ -792,24 +792,32 @@ ParaMath.prototype =
if(Math.abs(Diff) < SearchPos.DiffX + 0.001 ) if(Math.abs(Diff) < SearchPos.DiffX + 0.001 )
{ {
var X = SearchPos.X,
Y = SearchPos.Y;
if ( D >= - 0.001 && D <= Dx + 0.001 )
{
var X = SearchPos.X,
Y = SearchPos.Y;
SearchPos.X -= this.Math.absPos.x;
SearchPos.Y -= this.Math.absPos.y;
SearchPos.DiffX = Diff; SearchPos.X -= this.Math.absPos.x;
SearchPos.Y -= this.Math.absPos.y;
this.Root.Get_ParaContentPosByXY(SearchPos, Depth); SearchPos.DiffX = Diff;
SearchPos.X = X; //console.log("SearchPos.X : " + SearchPos.X);
SearchPos.Y = Y; //console.log("SearchPos.Y : " + SearchPos.Y);
this.Root.Get_ParaContentPosByXY(SearchPos, Depth);
SearchPos.X = X;
SearchPos.Y = Y;
Result = true;
//////////
Result = true;
if ( D >= - 0.001 && D <= Dx + 0.001 )
{
SearchPos.InText = true; SearchPos.InText = true;
SearchPos.DiffX = 0.001; // сравниваем расстояние до ближайшего элемента SearchPos.DiffX = 0.001; // сравниваем расстояние до ближайшего элемента
} }
...@@ -930,6 +938,8 @@ ParaMath.prototype = ...@@ -930,6 +938,8 @@ ParaMath.prototype =
Select_All : function(Direction) Select_All : function(Direction)
{ {
// TODO: ParaMath.Select_All // TODO: ParaMath.Select_All
this.bSelectionUse = true;
this.Root.Select_All();
}, },
Selection_DrawRange : function(_CurLine, _CurRange, SelectionDraw) Selection_DrawRange : function(_CurLine, _CurRange, SelectionDraw)
...@@ -947,14 +957,20 @@ ParaMath.prototype = ...@@ -947,14 +957,20 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Selection_Draw_Range // TODO: ParaMath.Selection_Draw_Range
var SelectH = SelectionDraw.H,
SelectStartY = SelectionDraw.StartY;
this.Root.Selection_DrawRange(SelectionDraw); this.Root.Selection_DrawRange(SelectionDraw);
if(this.Root.selectUse())
{
SelectionDraw.H = SelectH;
SelectionDraw.StartY = SelectStartY;
}
} }
else else
{ {
console.log(SelectionDraw.FindStart);
if ( true === SelectionDraw.FindStart ) if ( true === SelectionDraw.FindStart )
{ {
SelectionDraw.StartX += this.Width; SelectionDraw.StartX += this.Width;
...@@ -980,7 +996,7 @@ ParaMath.prototype = ...@@ -980,7 +996,7 @@ ParaMath.prototype =
Is_SelectedAll : function(Props) Is_SelectedAll : function(Props)
{ {
// TODO: ParaMath.Is_SelectedAll // TODO: ParaMath.Is_SelectedAll
return false; return this.Root.Is_SelectedAll(Props);
}, },
Selection_CorrectLeftPos : function(Direction) Selection_CorrectLeftPos : function(Direction)
......
...@@ -1246,8 +1246,8 @@ CMathBase.prototype = ...@@ -1246,8 +1246,8 @@ CMathBase.prototype =
Get_ParaContentPosByXY: function(SearchPos, Depth) Get_ParaContentPosByXY: function(SearchPos, Depth)
{ {
/// элементов just-draw не должно прийти /// элементов just-draw не должно прийти
//var disp = this.findDisposition({x: X, y: Y});
var disp = this.findDisposition({ x: SearchPos.X, y: SearchPos.Y}); var disp = this.findDisposition({ x: SearchPos.X - this.GapLeft, y: SearchPos.Y});
// TO DO // TO DO
// Рассмотреть дурацкий случай, если контент не заполнен, то тогда перейти в другой элемент // Рассмотреть дурацкий случай, если контент не заполнен, то тогда перейти в другой элемент
...@@ -1262,25 +1262,44 @@ CMathBase.prototype = ...@@ -1262,25 +1262,44 @@ CMathBase.prototype =
Depth +=2; Depth +=2;
//SearchPos.CurX += SearchPos.X - disp.mCoord.x;
//SearchPos.CurX += this.align(pos.x, pos.y).x;
SearchPos.X = disp.mCoord.x; SearchPos.X = disp.mCoord.x;
SearchPos.Y = disp.mCoord.y; SearchPos.Y = disp.mCoord.y;
//ContentPos.Add(disp.pos.x);
//ContentPos.Add(disp.pos.y);
this.elements[disp.pos.x][disp.pos.y].Get_ParaContentPosByXY(SearchPos, Depth); this.elements[disp.pos.x][disp.pos.y].Get_ParaContentPosByXY(SearchPos, Depth);
}, },
Get_ParaContentPos: function(bSelection, bStart, ContentPos) Get_ParaContentPos: function(bSelection, bStart, ContentPos)
{ {
ContentPos.Add(this.CurPos_X); if( bSelection )
ContentPos.Add(this.CurPos_Y); {
var SelectX, SelectY;
this.elements[this.CurPos_X][this.CurPos_Y].Get_ParaContentPos(bSelection, bStart, ContentPos); if(bStart)
{
SelectX = this.SelectStart_X;
SelectY = this.SelectStart_Y;
}
else
{
SelectX = this.SelectEnd_X;
SelectY = this.SelectEnd_Y;
}
ContentPos.Add(SelectX);
ContentPos.Add(SelectY);
if(SelectX !== -1 && SelectY !== -1)
this.elements[SelectX][SelectY].Get_ParaContentPos(bSelection, bStart, ContentPos);
}
else
{
ContentPos.Add(this.CurPos_X);
ContentPos.Add(this.CurPos_Y);
this.elements[this.CurPos_X][this.CurPos_Y].Get_ParaContentPos(bSelection, bStart, ContentPos);
}
}, },
Set_ParaContentPos: function(ContentPos, Depth) Set_ParaContentPos: function(ContentPos, Depth)
{ {
...@@ -1304,47 +1323,6 @@ CMathBase.prototype = ...@@ -1304,47 +1323,6 @@ CMathBase.prototype =
return this.elements[this.CurPos_X][this.CurPos_Y].Set_ParaContentPos(ContentPos, Depth); return this.elements[this.CurPos_X][this.CurPos_Y].Set_ParaContentPos(ContentPos, Depth);
}, },
set_StartSelectContent: function(ContentPos, Depth)
{
var Pos_X = ContentPos.Get(Depth),
Pos_Y = ContentPos.Get(Depth+1);
Depth += 2;
this.selectPos.startX = Pos_X;
this.selectPos.startY = Pos_Y;
if(!this.elements[Pos_X][Pos_Y].IsJustDraw())
this.elements[Pos_X][Pos_Y].set_StartSelectContent(ContentPos, Depth);
},
set_EndSelectContent: function(ContentPos, Depth)
{
var state = true, SelectContent = null;
var endX = ContentPos.Get(Depth),
endY = ContentPos.Get(Depth+1),
startX = this.selectPos.startX,
startY = this.selectPos.startY;
Depth += 2;
var bJustDraw = this.elements[endX][endY].IsJustDraw();
// пока так
if(startX == endX && startY == endY && !bJustDraw)
{
//this.CurPos_X = startX;
//this.CurPos_Y = startY;
var movement = this.elements[endX][endY].set_EndSelectContent(ContentPos, Depth);
SelectContent = movement.SelectContent;
state = movement.state;
}
else
state = false;
return {state: state, SelectContent: SelectContent};
},
Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag) Set_SelectionContentPos: function(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag)
{ {
var startX = StartContentPos.Get(Depth), var startX = StartContentPos.Get(Depth),
...@@ -1369,6 +1347,25 @@ CMathBase.prototype = ...@@ -1369,6 +1347,25 @@ CMathBase.prototype =
this.SelectEnd_X = endX; this.SelectEnd_X = endX;
this.SelectEnd_Y = endY; 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; Depth += 2;
var bJustDraw = this.elements[startX][startY].IsJustDraw(); var bJustDraw = this.elements[startX][startY].IsJustDraw();
...@@ -1390,8 +1387,12 @@ CMathBase.prototype = ...@@ -1390,8 +1387,12 @@ CMathBase.prototype =
}, },
Selection_IsEmpty: function() Selection_IsEmpty: function()
{ {
var result = false;
if(this.IsSelectEmpty()) if(this.IsSelectEmpty())
this.elements[this.SelectStart_X][this.SelectStart_Y].Selection_IsEmpty(); result = this.elements[this.SelectStart_X][this.SelectStart_Y].Selection_IsEmpty();
return result;
}, },
IsSelectEmpty: function() IsSelectEmpty: function()
{ {
......
This diff is collapsed.
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