Commit 6882edb8 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@61456 954022d7-b5bf-4e40-9824-e11837661b57
parent d04a9285
......@@ -26,7 +26,8 @@ function CMathBase(bInside)
this.bInside = bInside === true;
this.bMath_OneLine = true;
this.elements = [];
this.elements = [];
this.LinesWidths = [];
this.dW = 0; //column gap, gap width
this.dH = 0; //row gap, gap height
......@@ -998,7 +999,6 @@ CMathBase.prototype.NeedUpdate_CtrPrp = function()
if(null !== this.ParaMath)
this.ParaMath.SetNeedResize();
};
CMathBase.prototype.SelectToParent = function(bCorrect)
{
......@@ -1040,6 +1040,22 @@ CMathBase.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRang
PRSA.X += WidthVisible;
PRSA.LastW = WidthVisible;
};
CMathBase.prototype.Get_Width = function(_CurLine)
{
var Width = 0;
if(this.bMath_OneLine)
{
Width = this.size.width;
}
else
{
var CurLine = _CurLine - this.StartLine;
Width = this.LinesWidths[CurLine];
}
return Width;
};
CMathBase.prototype.Set_Paragraph = CParagraphContentWithParagraphLikeContent.prototype.Set_Paragraph;
CMathBase.prototype.Get_ElementByPos = CParagraphContentWithParagraphLikeContent.prototype.Get_ElementByPos;
CMathBase.prototype.Get_ParaPosByContentPos = CParagraphContentWithParagraphLikeContent.prototype.Get_ParaPosByContentPos;
......@@ -1392,108 +1408,30 @@ CMathBase.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selectio
var SelectionUse = this.Selection.Use;
if(this.bMath_OneLine)
if(SelectionUse == true)
{
if(SelectionUse == true)
if(SelectionStartPos !== SelectionEndPos)
{
if(SelectionStartPos !== SelectionEndPos)
{
SelectionDraw.FindStart = false;
SelectionDraw.W += this.size.width;
}
else
{
var Item = this.Content[SelectionStartPos];
var PosLine = this.ParaMath.GetLinePosition(_CurLine);
SelectionDraw.StartX = PosLine.x + Item.pos.x;
SelectionDraw.StartY = PosLine.y + Item.pos.y - Item.size.ascent;
SelectionDraw.H = Item.size.height;
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
}
else if(SelectionDraw.FindStart == true)
{
SelectionDraw.StartX += this.size.width;
}
}
else
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var LinesCount = this.protected_GetLinesCount();
if(SelectionUse == true)
{
if(SelectionStartPos !== SelectionEndPos)
{
SelectionDraw.FindStart = false;
var Direction = SelectionStartPos > SelectionEndPos ? - 1 : 1;
this.Select_All(Direction);
if(CurLine == 0)
SelectionDraw.W += this.GapLeft;
for(var Pos = StartPos; Pos <= EndPos; Pos++)
{
this.Content[Pos].Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
SelectionDraw.W += this.dW*(EndPos - StartPos);
if(LinesCount - 1 == CurLine)
SelectionDraw.W += this.GapRight;
}
else
{
if(CurLine == 0)
{
if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += this.GapLeft;
else
SelectionDraw.W += this.GapLeft;
}
this.Content[StartPos].Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
for(var Pos = StartPos + 1; Pos <= SelectionStartPos; Pos++)
{
var Item = this.Content[Pos];
if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += this.dW;
else
SelectionDraw.W += this.dW;
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
}
SelectionDraw.FindStart = false;
SelectionDraw.W += this.size.width;
}
else if(SelectionDraw.FindStart == true)
else
{
if(CurLine == 0)
SelectionDraw.StartX += this.GapLeft;
var Item = this.Content[SelectionStartPos];
this.Content[StartPos].Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
var PosLine = this.ParaMath.GetLinePosition(_CurLine);
for(var Pos = StartPos + 1; Pos <= EndPos; Pos++)
{
var Item = this.Content[Pos];
SelectionDraw.StartX += this.dW;
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
SelectionDraw.StartX = PosLine.x + Item.pos.x;
SelectionDraw.StartY = PosLine.y + Item.pos.y - Item.size.ascent;
SelectionDraw.H = Item.size.height;
if(LinesCount - 1 == CurLine)
SelectionDraw.StartX += this.GapRight;
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
}
else if(SelectionDraw.FindStart == true)
{
SelectionDraw.StartX += this.size.width;
}
};
CMathBase.prototype.Selection_IsEmpty = function()
......@@ -2089,6 +2027,8 @@ CMathBase_2.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRan
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var RangeW = PRSC.Range.W;
if(CurLine == 0 && CurRange == 0)
PRSC.Range.W += this.GapLeft;
......@@ -2114,6 +2054,8 @@ CMathBase_2.prototype.Recalculate_Range_Width = function(PRSC, _CurLine, _CurRan
{
PRSC.Range.W += this.GapRight;
}
this.LinesWidths[CurLine] = PRSC.Range.W - RangeW;
};
CMathBase_2.prototype.Draw_Elements = function(PDSE)
{
......@@ -2141,7 +2083,7 @@ CMathBase_2.prototype.Draw_Elements = function(PDSE)
PDSE.X += this.GapRight;
}
};
CMathBase_2.prototype.Selection_DrawRange_2 = function(_CurLine, _CurRange, SelectionDraw)
CMathBase_2.prototype.Selection_DrawRange = function(_CurLine, _CurRange, SelectionDraw)
{
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
......@@ -2149,59 +2091,45 @@ CMathBase_2.prototype.Selection_DrawRange_2 = function(_CurLine, _CurRange, Sele
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
var LinesCount = this.protected_GetLinesCount();
var SelectionStartPos = this.Selection.StartPos;
var SelectionEndPos = this.Selection.EndPos;
var SelectionUse = this.Selection.Use;
var LenContent = this.Content.length;
var LinesCount = this.protected_GetLinesCount();
if(SelectionStartPos !== SelectionEndPos && SelectionUse == true)
if(SelectionUse == true && SelectionStartPos !== SelectionEndPos)
{
SelectionDraw.FindStart = false;
SelectionDraw.DrawSelection = true;
this.Select_All();
SelectionDraw.W += this.LinesWidths[CurLine];
if(CurLine == 0)
SelectionDraw.W += this.GapLeft;
for(var Pos = StartPos; Pos <= EndPos; Pos++)
{
SelectionDraw.W += this.dW*Pos;
this.Content[Pos].Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
if(SelectionUse == false && LinesCount - 1 == CurLine)
SelectionDraw.W += this.GapRight;
}
else
{
if(CurLine == 0)
SelectionDraw.StartX += this.GapLeft;
{
if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += this.GapLeft;
else if(SelectionUse == true)
SelectionDraw.W += this.GapLeft;
}
this.Content[StartPos].Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
var Len = SelectionUse == false ? EndPos : Math.min(EndPos, SelectionStartPos);
var Len = SelectionUse == true ? Math.min(EndPos, SelectionStartPos) : EndPos;
for(var Pos = StartPos; Pos <= Len; Pos++)
for(var Pos = StartPos + 1; Pos <= Len; Pos++)
{
var Item = this.Content[Pos];
SelectionDraw.StartX += this.dW*Pos;
var bNeed_changeSelection = Item.bOneLine == false || (SelectionUse == true && Pos == SelectionStartPos);
if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += this.dW;
else if(SelectionUse == true)
SelectionDraw.W += this.dW;
if(bNeed_changeSelection)
{
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
else
{
SelectionDraw.StartX += Item.size.width;
}
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
if(SelectionUse == false && LinesCount - 1 == CurLine)
if(SelectionDraw.FindStart == true && LinesCount - 1 == CurLine)
SelectionDraw.StartX += this.GapRight;
}
};
\ No newline at end of file
......@@ -3812,15 +3812,6 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec
SelectionEndPos = this.Selection.Start;
}
// Выставляем высоту селекта. В верхнем контенте высота задается параграфом
/*if(true !== this.bRoot)
{
var PosLine = this.ParaMath.GetLinePosition(_CurLine);
SelectionDraw.StartX = PosLine.x + this.pos.x;
SelectionDraw.StartY = PosLine.y + this.pos.y - this.size.ascent;
SelectionDraw.H = this.size.height;
}*/
var SelectionUse = this.Selection.Use;
var CurLine = _CurLine - this.StartLine;
......@@ -3837,29 +3828,11 @@ CMathContent.prototype.Selection_DrawRange = function(_CurLine, _CurRange, Selec
if(Item.Type == para_Math_Composition && bSelectAll)
{
var Direction = SelectionStartPos > SelectionEndPos ? -1 : 1;
Item.Select_All(Direction);
}
Item.Selection_DrawRange( _CurLine, _CurRange, SelectionDraw );
/*if(Item.Type == para_Math_Composition)
{
if(SelectionUse && SelectionStartPos == CurPos && SelectionStartPos == SelectionEndPos)
{
Item.Selection_DrawRange(_CurLine, _CurRange, SelectionDraw);
}
else if(SelectionUse && SelectionStartPos <= CurPos && CurPos <= SelectionEndPos)
{
SelectionDraw.FindStart = false;
SelectionDraw.DrawSelection = true;
SelectionDraw.W += Item.size.width;
}
else if(SelectionDraw.FindStart == true)
SelectionDraw.StartX += Item.size.width;
SelectionDraw.FindStart = false;
SelectionDraw.W += Item.Get_Width(_CurLine);
}
else
Item.Selection_DrawRange( _CurLine, _CurRange, SelectionDraw );*/
Item.Selection_DrawRange( _CurLine, _CurRange, SelectionDraw );
}
};
CMathContent.prototype.Select_ElementByPos = function(nPos, bWhole)
......
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