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

Переделала селект (под EqqArray)

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@58086 954022d7-b5bf-4e40-9824-e11837661b57
parent a06bfbd0
...@@ -872,13 +872,6 @@ ParaMath.prototype = ...@@ -872,13 +872,6 @@ ParaMath.prototype =
//var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos; //var StartPos = this.Lines[CurLine].Ranges[CurRange].StartPos;
var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos; var EndPos = this.Lines[CurLine].Ranges[CurRange].EndPos;
/*if(this.Id == "81")
{
console.log("CurLine " + _CurLine +" CurRange " + _CurRange );
console.log("StartLine " + this.StartLine + " StartRange " + this.StartRange);
console.log("Current CurLine "+ CurLine + " Current CurRange " + CurRange);
}*/
var result = {X: _X + this.Root.size.width}; var result = {X: _X + this.Root.size.width};
...@@ -1285,8 +1278,6 @@ ParaMath.prototype = ...@@ -1285,8 +1278,6 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Cursor_MoveToStartPos // TODO: ParaMath.Cursor_MoveToStartPos
//console.log("Cursor_MoveToStartPos");
this.Root.Cursor_MoveToStartPos(); this.Root.Cursor_MoveToStartPos();
}, },
...@@ -1319,15 +1310,8 @@ ParaMath.prototype = ...@@ -1319,15 +1310,8 @@ ParaMath.prototype =
var Dx = this.Root.size.width; var Dx = this.Root.size.width;
var D = SearchPos.X - SearchPos.CurX; var D = SearchPos.X - SearchPos.CurX;
/*var startDx = Math.abs(D),
endDx = Math.abs(D - Dx);*/
//var Diff = startDx < endDx ? startDx : endDx;
var CurX = SearchPos.CurX; var CurX = SearchPos.CurX;
//SearchPos.CurY = SearchPos.Y - this.Y;
Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd); Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
if ( D >= - 0.001 && D <= Dx + 0.001 ) if ( D >= - 0.001 && D <= Dx + 0.001 )
...@@ -1335,53 +1319,6 @@ ParaMath.prototype = ...@@ -1335,53 +1319,6 @@ ParaMath.prototype =
SearchPos.DiffX = 0.001; SearchPos.DiffX = 0.001;
} }
/*var str = "";
for(var i = 0; i < SearchPos.Pos.Data.length; i++)
{
str += SearchPos.Pos.Data[i] + " ";
}
console.log(str);*/
/*if(Math.abs(Diff) < SearchPos.DiffX + 0.001)
{
if ( D >= - 0.001 && D <= Dx + 0.001 )
{
var X = SearchPos.X,
Y = SearchPos.Y;
SearchPos.X -= this.X;
SearchPos.Y -= this.Y;
this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
SearchPos.X = X;
SearchPos.Y = Y;
//////////
SearchPos.InText = true;
SearchPos.DiffX = 0.001; // сравниваем расстояние до ближайшего элемента
}
else if(startDx < endDx)
{
this.Get_StartPos(SearchPos.Pos, Depth);
SearchPos.DiffX = Diff;
}
else
{
this.Get_EndPos(false, SearchPos.Pos, Depth);
SearchPos.DiffX = Diff - 0.0015;
}
Result = true;
}*/
SearchPos.CurX = CurX + Dx; SearchPos.CurX = CurX + Dx;
} }
...@@ -1517,6 +1454,11 @@ ParaMath.prototype = ...@@ -1517,6 +1454,11 @@ ParaMath.prototype =
{ {
// TODO: ParaMath.Set_SelectionContentPos // TODO: ParaMath.Set_SelectionContentPos
//console.log("Set_SelectionContentPos");
/*if(this.bSelectionUse)
this.Selection_Remove();*/
this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag); this.Root.Set_SelectionContentPos(StartContentPos, EndContentPos, Depth, StartFlag, EndFlag);
this.bSelectionUse = true; this.bSelectionUse = true;
}, },
...@@ -1536,6 +1478,7 @@ ParaMath.prototype = ...@@ -1536,6 +1478,7 @@ ParaMath.prototype =
// TODO: ParaMath.Selection_Remove // TODO: ParaMath.Selection_Remove
this.bSelectionUse = false; this.bSelectionUse = false;
console.log("Selection_Remove");
this.Root.Selection_Remove(); this.Root.Selection_Remove();
}, },
...@@ -1563,10 +1506,15 @@ ParaMath.prototype = ...@@ -1563,10 +1506,15 @@ ParaMath.prototype =
var result = this.GetSelectContent(); var result = this.GetSelectContent();
result.Content.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
/*
var Start = result.Start, var Start = result.Start,
End = result.End, End = result.End,
oCont = result.Content; oCont = result.Content;
SelectionDraw.StartX += oCont.pos.x + oCont.WidthToElement[Start]; SelectionDraw.StartX += oCont.pos.x + oCont.WidthToElement[Start];
...@@ -1589,7 +1537,7 @@ ParaMath.prototype = ...@@ -1589,7 +1537,7 @@ ParaMath.prototype =
//SelectionDraw.StartY = this.Math.absPos.y + oCont.pos.y; // выставляем так, чтобы для формул с различной высотой в одной строке, всё было ok //SelectionDraw.StartY = this.Math.absPos.y + oCont.pos.y; // выставляем так, чтобы для формул с различной высотой в одной строке, всё было ok
SelectionDraw.StartY = this.Y + oCont.pos.y; // выставляем так, чтобы для формул с различной высотой в одной строке, всё было ok SelectionDraw.StartY = this.Y + oCont.pos.y; // выставляем так, чтобы для формул с различной высотой в одной строке, всё было ok
SelectionDraw.H = oCont.size.height; SelectionDraw.H = oCont.size.height;
} }*/
} }
else else
...@@ -1673,13 +1621,3 @@ ParaMath.prototype = ...@@ -1673,13 +1621,3 @@ ParaMath.prototype =
} }
}; };
/*
var MATH_CTX = null;
function TEST_MATH_ImageConverter()
{
var dataImg = editor.WordControl.m_oLogicDocument.Content[0].Content[0].MathToImageConverter();
console.log(dataImg.ImageUrl);
}*/
...@@ -625,7 +625,7 @@ ParaRun.prototype = ...@@ -625,7 +625,7 @@ ParaRun.prototype =
return new CParaPos( ( LinesCount === 1 ? this.Lines[0].RangesLength - 1 + this.StartRange : this.Lines[0].RangesLength - 1 ), LinesCount - 1 + this.StartLine, 0, 0 ); return new CParaPos( ( LinesCount === 1 ? this.Lines[0].RangesLength - 1 + this.StartRange : this.Lines[0].RangesLength - 1 ), LinesCount - 1 + this.StartLine, 0, 0 );
}, },
Recalculate_CurPos : function(X, Y, CurrentRun, _CurRange, _CurLine, CurPage, UpdateCurPos, UpdateTarget, ReturnTarget, PointInfo) Recalculate_CurPos : function(X, Y, CurrentRun, _CurRange, _CurLine, CurPage, UpdateCurPos, UpdateTarget, ReturnTarget, PointsInfo)
{ {
var Para = this.Paragraph; var Para = this.Paragraph;
...@@ -666,8 +666,8 @@ ParaRun.prototype = ...@@ -666,8 +666,8 @@ ParaRun.prototype =
} }
case para_Math_Ampersand: case para_Math_Ampersand:
{ {
PointInfo.NextAlignRange(); PointsInfo.NextAlignRange();
X += PointInfo.GetAlign(); X += PointsInfo.GetAlign();
} }
} }
} }
...@@ -3706,7 +3706,7 @@ ParaRun.prototype = ...@@ -3706,7 +3706,7 @@ ParaRun.prototype =
} }
}, },
Get_ParaContentPosByXY : function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, PointInfo) Get_ParaContentPosByXY : function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, PointsInfo)
{ {
var Result = false; var Result = false;
...@@ -3729,8 +3729,8 @@ ParaRun.prototype = ...@@ -3729,8 +3729,8 @@ ParaRun.prototype =
if(Item.Type == para_Math_Ampersand) if(Item.Type == para_Math_Ampersand)
{ {
PointInfo.NextAlignRange(); PointsInfo.NextAlignRange();
TempDx = PointInfo.GetAlign(); TempDx = PointsInfo.GetAlign();
} }
else if ( para_Drawing != Item.Type || true === Item.Is_Inline() ) else if ( para_Drawing != Item.Type || true === Item.Is_Inline() )
{ {
...@@ -4358,7 +4358,7 @@ ParaRun.prototype = ...@@ -4358,7 +4358,7 @@ ParaRun.prototype =
} }
}, },
Selection_DrawRange : function(_CurLine, _CurRange, SelectionDraw) Selection_DrawRange : function(_CurLine, _CurRange, SelectionDraw, PointsInfo)
{ {
var CurLine = _CurLine - this.StartLine; var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange ); var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
...@@ -4395,7 +4395,12 @@ ParaRun.prototype = ...@@ -4395,7 +4395,12 @@ ParaRun.prototype =
} }
else else
{ {
if ( para_Drawing !== Item.Type || true === Item.Is_Inline() ) if(Item.Type == para_Math_Ampersand)
{
PointsInfo.NextAlignRange();
SelectionDraw.StartX += PointsInfo.GetAlign();
}
else if ( para_Drawing !== Item.Type || true === Item.Is_Inline() )
SelectionDraw.StartX += Item.WidthVisible; SelectionDraw.StartX += Item.WidthVisible;
} }
} }
...@@ -4411,6 +4416,11 @@ ParaRun.prototype = ...@@ -4411,6 +4416,11 @@ ParaRun.prototype =
{ {
if ( para_Drawing === Item.Type && true !== Item.Is_Inline() ) if ( para_Drawing === Item.Type && true !== Item.Is_Inline() )
Item.Draw_Selection(); Item.Draw_Selection();
else if(Item.Type == para_Math_Ampersand)
{
PointsInfo.NextAlignRange();
SelectionDraw.W += PointsInfo.GetAlign();
}
else else
SelectionDraw.W += Item.WidthVisible; SelectionDraw.W += Item.WidthVisible;
} }
......
...@@ -760,9 +760,16 @@ CMathBase.prototype = ...@@ -760,9 +760,16 @@ CMathBase.prototype =
return result; return result;
}, },
Selection_DrawRange: function(CurLine, CurPage, SelectionDraw) // первые два параметра нужны только для аналогичной функции в ParaRun Selection_DrawRange: function(CurLine, CurPage, SelectionDraw) // первые два параметра нужны только для аналогичной функции в ParaRun
{
if(SelectionDraw.FindStart == false)
{ {
SelectionDraw.W += this.size.width; SelectionDraw.W += this.size.width;
SelectionDraw.FindStart = false; }
/*else
{
SelectionDraw.StartX += this.size.width;
}*/
//SelectionDraw.FindStart = true;
}, },
SetRunEmptyToContent: function(bAll) SetRunEmptyToContent: function(bAll)
{ {
......
...@@ -872,7 +872,6 @@ function CMathContent() ...@@ -872,7 +872,6 @@ function CMathContent()
this.CurPos = 0; this.CurPos = 0;
this.WidthToElement = []; this.WidthToElement = [];
//this.WidthPoints = []; /// for EqqArray Runs
this.pos = new CMathPosition(); // относительная позиция this.pos = new CMathPosition(); // относительная позиция
// Properties // Properties
...@@ -4527,6 +4526,78 @@ CMathContent.prototype = ...@@ -4527,6 +4526,78 @@ CMathContent.prototype =
this.Parent.SelectToParent(); this.Parent.SelectToParent();
}, },
Selection_DrawRange: function(_CurLine, _CurRange, SelectionDraw)
{
/*var result = this.GetSelectContent();
var Start = result.Start,
End = result.End,
oCont = result.Content;*/
var Start = this.Selection.Start,
End = this.Selection.End;
if(Start > End)
{
Start = this.Selection.End;
End = this.Selection.Start;
}
SelectionDraw.StartX += this.pos.x /*+ oCont.WidthToElement[Start]*/;
var PointsInfo = new CMathPointInfo();
PointsInfo.SetInfoPoints(this.InfoPoints);
if(this.RecalcInfo.bEqqArray)
{
if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += PointsInfo.GetAlign();
else
SelectionDraw.W += PointsInfo.GetAlign();
}
var DrawSelection = false;
for(var i = 0; i < this.content.length; i++)
{
/*if( i >= Start && i < End + 1)
SelectionDraw.FindStart = false;
else
SelectionDraw.FindStart = true;*/
DrawSelection = i >= Start && i <= End ? true : false;
/*if(i >= Start && i < End )
{
DrawSelection = true;
}
else
DrawSelection = false;*/
if(DrawSelection == false)
this.content[i].Selection_Remove();
else if(i > Start && i < End && this.content[i].Type == para_Math_Run) /// чтобы избежать багов, которые возникают при выходе за границы формулы (при резком движении мышки например в направлении начала формулы)
this.content[i].Select_All();
if(this.content[i].Type == para_Math_Run)
this.content[i].Selection_DrawRange(_CurLine, _CurRange, SelectionDraw, PointsInfo);
else
{
if(DrawSelection == true)
{
SelectionDraw.W += this.content[i].size.width;
SelectionDraw.FindStart = false;
}
else if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += this.content[i].size.width;
}
}
if(!this.bRoot)
{
SelectionDraw.StartY = this.ParaMath.Y + this.pos.y; // выставляем так, чтобы для формул с различной высотой в одной строке, всё было ok
SelectionDraw.H = this.size.height;
}
},
/////////////////////// ///////////////////////
......
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