Commit bf146b1d 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@63224 954022d7-b5bf-4e40-9824-e11837661b57
parent 5cad5cde
...@@ -347,10 +347,6 @@ function CMathInfo() ...@@ -347,10 +347,6 @@ function CMathInfo()
this.bWordLarge = false; this.bWordLarge = false;
this.NeedUpdateWrap = true; this.NeedUpdateWrap = true;
} }
CMathInfo.prototype.GetFirstLineOnPage = function()
{
return this.FirstLineOnPage;
};
CMathInfo.prototype.GetCountLines = function() CMathInfo.prototype.GetCountLines = function()
{ {
return this.LineWidths.GetCountLines(); return this.LineWidths.GetCountLines();
...@@ -448,12 +444,11 @@ CMathPageInfo.prototype.IsFirstPage = function(_Page) ...@@ -448,12 +444,11 @@ CMathPageInfo.prototype.IsFirstPage = function(_Page)
}; };
CMathPageInfo.prototype.GetStarLinetWidth = function() CMathPageInfo.prototype.GetStarLinetWidth = function()
{ {
return this.Info[0].LineWidths.Get(0); return this.Info[0].LineWidths.GetFirst();
}; };
CMathPageInfo.prototype.UpdateCurrentWidth = function(_Line, Width) CMathPageInfo.prototype.UpdateCurrentWidth = function(_Line, Width)
{ {
var Line = this.Info[this.CurPage].GetNumberLine(_Line - this.StartLine); var Line = this.Info[this.CurPage].GetNumberLine(_Line - this.StartLine);
//var Line = _Line - this.StartLine - this.Info[this.CurPage].FirstLineOnPage;
return this.Info[this.CurPage].LineWidths.UpdateWidth(Line, Width); return this.Info[this.CurPage].LineWidths.UpdateWidth(Line, Width);
}; };
...@@ -509,7 +504,7 @@ CMathPageInfo.prototype.GetFirstLineOnPage = function(_Page) ...@@ -509,7 +504,7 @@ CMathPageInfo.prototype.GetFirstLineOnPage = function(_Page)
{ {
var Page = _Page - this.StartPage; var Page = _Page - this.StartPage;
var FirstLineOnPage = this.Info[Page].GetFirstLineOnPage(); var FirstLineOnPage = this.Info[Page].FirstLineOnPage;
return this.StartLine + FirstLineOnPage; return this.StartLine + FirstLineOnPage;
}; };
...@@ -773,7 +768,7 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, _Page, _X, _X ...@@ -773,7 +768,7 @@ ParaMath.prototype.Get_AlignToLine = function(_CurLine, _CurRange, _Page, _X, _X
W = MaxW; W = MaxW;
} }
if(this.Root.IsStartLine(_CurLine)) // первая строка первой страницы if(this.Root.IsFirstRange(_CurLine, _CurRange)) // первая строка первой страницы, если строка разбивается на несколько отрезко, то это уже будет inline-формула
{ {
switch(Jc) switch(Jc)
{ {
...@@ -1146,7 +1141,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1146,7 +1141,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var Page = AbsolutePage + PRS.Page; var Page = AbsolutePage + PRS.Page;
var PrevLineObject = PRS.RestartPageRecalcInfo.Object; var PrevLineObject = PRS.RestartPageRecalcInfo.Object;
var bStartLine = this.Root.IsStartLine(ParaLine); var bFirstRange = this.Root.IsFirstRange(ParaLine, ParaRange);
var MathSettings = Get_WordDocumentDefaultMathSettings(); var MathSettings = Get_WordDocumentDefaultMathSettings();
...@@ -1156,7 +1151,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1156,7 +1151,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ArgSize = new CMathArgSize(); var ArgSize = new CMathArgSize();
// первый пересчет // первый пересчет
if(PrevLineObject == null && true == bStartLine && PRS.bFastRecalculate == false) if(PrevLineObject == null && true == bFirstRange && PRS.bFastRecalculate == false)
{ {
this.PageInfo.Reset(); this.PageInfo.Reset();
this.PageInfo.SetStartPos(Page, ParaLine); this.PageInfo.SetStartPos(Page, ParaLine);
...@@ -1189,7 +1184,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1189,7 +1184,7 @@ ParaMath.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
PRS.WrapIndent = WrapIndent; PRS.WrapIndent = WrapIndent;
if(bStartLine == false) if(this.Root.IsStartLine() == false)
{ {
PRS.X += WrapIndent; PRS.X += WrapIndent;
PRS.bCompareWrapIndent = false; PRS.bCompareWrapIndent = false;
...@@ -1328,6 +1323,13 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange ...@@ -1328,6 +1323,13 @@ ParaMath.prototype.Recalculate_Range_Spaces = function(PRSA, _CurLine, _CurRange
Page = this.Paragraph.Get_StartPage_Absolute(); Page = this.Paragraph.Get_StartPage_Absolute();
var pos = new CMathPosition(); var pos = new CMathPosition();
if(false == this.Root.IsStartRange(_CurLine, _CurRange))
{
var LinePos = this.Root.GetPos(_CurLine);
pos.x += PRSA.X - LinePos.x;
}
this.Root.setPosition(pos, PRSA, _CurLine, _CurRange, Page + _CurPage); this.Root.setPosition(pos, PRSA, _CurLine, _CurRange, Page + _CurPage);
this.Root.Recalculate_Range_Spaces(PRSA, _CurLine, _CurRange, Page + _CurPage); this.Root.Recalculate_Range_Spaces(PRSA, _CurLine, _CurRange, Page + _CurPage);
...@@ -1436,18 +1438,8 @@ ParaMath.prototype.Recalculate_MinMaxContentWidth = function(MinMax) ...@@ -1436,18 +1438,8 @@ ParaMath.prototype.Recalculate_MinMaxContentWidth = function(MinMax)
ParaMath.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange) ParaMath.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange)
{ {
var CurLine = _CurLine - this.StartLine; this.Root.Get_Range_VisibleWidth(RangeW, _CurLine, _CurRange);
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange );
var StartPos = this.protected_GetRangeStartPos(CurLine, CurRange);
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
if ( EndPos >= 1 )
{
RangeW.W += this.Width;
}
}; };
ParaMath.prototype.Is_BrkBinBefore = function() ParaMath.prototype.Is_BrkBinBefore = function()
{ {
var MathSettings = Get_WordDocumentDefaultMathSettings(); var MathSettings = Get_WordDocumentDefaultMathSettings();
...@@ -1921,39 +1913,6 @@ ParaMath.prototype.Cursor_MoveToEndPos = function(SelectFromEnd) ...@@ -1921,39 +1913,6 @@ ParaMath.prototype.Cursor_MoveToEndPos = function(SelectFromEnd)
this.Root.Cursor_MoveToEndPos(SelectFromEnd); this.Root.Cursor_MoveToEndPos(SelectFromEnd);
}; };
ParaMath.prototype.old_Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
{
var Result = false;
var CurLine = _CurLine - this.StartLine;
var CurRange = ( 0 === CurLine ? _CurRange - this.StartRange : _CurRange ); // если находимся в нулевой строке (для текущей позиции), то CurRange мб ненулевой
var EndPos = this.protected_GetRangeEndPos(CurLine, CurRange);
// Проверяем, попали ли мы в формулу
if ( EndPos >= 1 )
{
var Dx = this.Root.size.width;
var D = SearchPos.X - SearchPos.CurX;
var CurX = SearchPos.CurX;
Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
if ( D >= - 0.001 && D <= Dx + 0.001 )
{
SearchPos.InText = true;
SearchPos.DiffX = 0.001;
SearchPos.InTextPos.Copy_FromDepth(SearchPos.Pos, Depth);
}
SearchPos.CurX = CurX + Dx;
}
return Result;
};
ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY ParaMath.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd, Flag) // получить логическую позицию по XY
{ {
var Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd); var Result = this.Root.Get_ParaContentPosByXY(SearchPos, Depth, _CurLine, _CurRange, StepEnd);
......
...@@ -1011,7 +1011,7 @@ ParaRun.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth) ...@@ -1011,7 +1011,7 @@ ParaRun.prototype.Get_ParaPosByContentPos = function(ContentPos, Depth)
}; };
ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _CurLine, CurPage, UpdateCurPos, UpdateTarget, ReturnTarget, PointsInfo) ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _CurLine, CurPage, UpdateCurPos, UpdateTarget, ReturnTarget)
{ {
var Para = this.Paragraph; var Para = this.Paragraph;
...@@ -1030,9 +1030,11 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu ...@@ -1030,9 +1030,11 @@ ParaRun.prototype.Recalculate_CurPos = function(X, Y, CurrentRun, _CurRange, _Cu
Pos = _EndPos; Pos = _EndPos;
var loc; var LocParaMath = this.ParaMath.GetLinePosition(_CurLine);
var MATH_X = X; X = LocParaMath.x;
var MATH_Y = Y; var MATH_Y = Y;
var loc;
if(Lng == 0) if(Lng == 0)
{ {
...@@ -2071,6 +2073,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2071,6 +2073,8 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var ContentLen = this.Content.length; var ContentLen = this.Content.length;
var XRange = PRS.XRange; var XRange = PRS.XRange;
var bAbsent_Internal_Ranges;
if (false === StartWord && true === FirstItemOnLine && XEnd - X < 0.001 && RangesCount > 0) if (false === StartWord && true === FirstItemOnLine && XEnd - X < 0.001 && RangesCount > 0)
{ {
NewRange = true; NewRange = true;
...@@ -2198,7 +2202,6 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2198,7 +2202,6 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
// При проверке, убирается ли слово, мы должны учитывать ширину предшествующих пробелов. // При проверке, убирается ли слово, мы должны учитывать ширину предшествующих пробелов.
var LetterLen = Item.Get_Width2() / TEXTWIDTH_DIVIDER;//var LetterLen = Item.Get_Width(); var LetterLen = Item.Get_Width2() / TEXTWIDTH_DIVIDER;//var LetterLen = Item.Get_Width();
if (true !== Word) if (true !== Word)
{ {
// Слово только началось. Делаем следующее: // Слово только началось. Делаем следующее:
...@@ -2228,7 +2231,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2228,7 +2231,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{ {
if(X + SpaceLen + WordLen + LetterLen > XEnd) if(X + SpaceLen + WordLen + LetterLen > XEnd)
{ {
if(true === FirstItemOnLine) if(true === FirstItemOnLine && true === Para.Internal_Check_Ranges(ParaLine, ParaRange))
{ {
// Слово оказалось единственным элементом в промежутке, и, все равно, // Слово оказалось единственным элементом в промежутке, и, все равно,
// не умещается целиком. Делаем следующее: // не умещается целиком. Делаем следующее:
...@@ -2288,11 +2291,13 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2288,11 +2291,13 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
bNoOneBreakOperator = false; bNoOneBreakOperator = false;
var bFirstItem = true === FirstItemOnLine && true === Para.Internal_Check_Ranges(ParaLine, ParaRange);
if(bOperInEndContent || bLowPriority) if(bOperInEndContent || bLowPriority)
{ {
if(X + SpaceLen + WordLen + BrkLen > XEnd) if(X + SpaceLen + WordLen + BrkLen > XEnd)
{ {
if(true === FirstItemOnLine) if(bFirstItem == true)
{ {
bMathWordLarge = true; bMathWordLarge = true;
} }
...@@ -2318,7 +2323,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2318,7 +2323,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var bOverXEnd; var bOverXEnd;
if(bCompareOper && bFirstCompareOper == true && PRS.bCompareWrapIndent == true && WorLenCompareOper > PRS.WrapIndent && !(Word == false && FirstItemOnLine == true)) // (Word == true && FirstItemOnLine == true) - не первый элемент в строке if(bCompareOper && bFirstCompareOper == true && PRS.bCompareWrapIndent == true && WorLenCompareOper > PRS.WrapIndent && !(Word == false && bFirstItem == true)) // (Word == true && FirstItemOnLine == true) - не первый элемент в строке
bFirstCompareOper = false; bFirstCompareOper = false;
if(bOperBefore) // оператор "до" if(bOperBefore) // оператор "до"
...@@ -2326,7 +2331,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2326,7 +2331,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
bOverXEnd = X + WordLen + SpaceLen > XEnd; bOverXEnd = X + WordLen + SpaceLen > XEnd;
if(bOverXEnd && FirstItemOnLine == false) // Слово не убирается в отрезке. Переносим слово в следующий отрезок if(bOverXEnd && bFirstItem == false) // Слово не убирается в отрезке. Переносим слово в следующий отрезок
{ {
MoveToLBP = true; MoveToLBP = true;
NewRange = true; NewRange = true;
...@@ -2351,15 +2356,15 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2351,15 +2356,15 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
if(SpaceLen !== 0) if(SpaceLen !== 0)
FirstItemOnLine = false; FirstItemOnLine = false;
if(FirstItemOnLine == false) if(bFirstItem == false)
{
PRS.Set_LineBreakPos(Pos); PRS.Set_LineBreakPos(Pos);
}
// FirstItemOnLine == true && Word == false else
// первое слово в строке
if(FirstItemOnLine == true)
{ {
SpaceLen += BrkLen - Item.GapLeft; SpaceLen += BrkLen - Item.GapLeft;
} }
} }
} }
} }
...@@ -2367,7 +2372,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -2367,7 +2372,7 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
{ {
bOverXEnd = X + WordLen + BrkLen - Item.GapRight > XEnd; bOverXEnd = X + WordLen + BrkLen - Item.GapRight > XEnd;
if(bOverXEnd && FirstItemOnLine == false) // Слово не убирается в отрезке. Переносим слово в следующий отрезок if(bOverXEnd && bFirstItem == false) // Слово не убирается в отрезке. Переносим слово в следующий отрезок
{ {
MoveToLBP = true; MoveToLBP = true;
NewRange = true; NewRange = true;
...@@ -3729,12 +3734,14 @@ ParaRun.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange) ...@@ -3729,12 +3734,14 @@ ParaRun.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange)
case para_Sym: case para_Sym:
case para_Text: case para_Text:
case para_Space: case para_Space:
case para_Math_Text:
case para_Math_Ampersand:
case para_Math_Placeholder:
case para_Math_BreakOperator:
{ {
RangeW.W += Item.Get_WidthVisible(); RangeW.W += Item.Get_WidthVisible();
break; break;
} }
case para_Drawing: case para_Drawing:
{ {
if ( true === Item.Is_Inline() ) if ( true === Item.Is_Inline() )
......
...@@ -1305,76 +1305,8 @@ CMathBase.prototype.Recalculate_CurPos = function(_X, Y, CurrentRun, _CurRange, ...@@ -1305,76 +1305,8 @@ CMathBase.prototype.Recalculate_CurPos = function(_X, Y, CurrentRun, _CurRange,
{ {
return this.Content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget); return this.Content[this.CurPos].Recalculate_CurPos(_X, Y, CurrentRun, _CurRange, _CurLine, _CurPage, UpdateCurPos, UpdateTarget, ReturnTarget);
}; };
CMathBase.prototype.old_Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var nCount = this.Content.length;
if (nCount <= 0)
return false;
var aBounds = [];
for (var nIndex = 0; nIndex < nCount; nIndex++)
{
var oBounds = this.Content[nIndex].Get_Bounds();
if (oBounds.W > 0.001 && oBounds.H > 0.001)
aBounds.push(oBounds);
else
aBounds.push(null);
}
var X = SearchPos.X;
var Y = SearchPos.Y;
var dDiff = null;
var nCurIndex = 0;
var nFindIndex = 0;
while (nCurIndex < nCount)
{
var oBounds = aBounds[nCurIndex];
if (null !== oBounds)
{
if (oBounds.X <= X && X <= oBounds.X + oBounds.W && oBounds.Y <= Y && Y <= oBounds.Y + oBounds.H)
{
nFindIndex = nCurIndex;
break;
}
else
{
var dCurDiffX = X - (oBounds.X + oBounds.W / 2);
var dCurDiffY = Y - (oBounds.Y + oBounds.H / 2);
var dCurDiff = dCurDiffX * dCurDiffX + dCurDiffY * dCurDiffY;
if (null === dDiff || dDiff > dCurDiff)
{
dDiff = dCurDiff;
nFindIndex = nCurIndex;
}
}
}
nCurIndex++;
}
if (null === aBounds[nFindIndex])
return false;
SearchPos.CurX = aBounds[nFindIndex].X;
SearchPos.CurY = aBounds[nFindIndex].Y;
var bResult = this.Content[nFindIndex].Get_ParaContentPosByXY(SearchPos, Depth + 1, _CurLine, _CurRange, StepEnd);
if(true === bResult)
{
SearchPos.Pos.Update2(nFindIndex, Depth);
}
return bResult;
};
CMathBase.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd) CMathBase.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{ {
var bResult = false;
var nCount = this.Content.length; var nCount = this.Content.length;
if (nCount <= 0) if (nCount <= 0)
return false; return false;
...@@ -1438,7 +1370,8 @@ CMathBase.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine ...@@ -1438,7 +1370,8 @@ CMathBase.prototype.Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine
SearchPos.CurX = aBounds[nFindIndex].X; SearchPos.CurX = aBounds[nFindIndex].X;
SearchPos.CurY = aBounds[nFindIndex].Y; SearchPos.CurY = aBounds[nFindIndex].Y;
bResult = this.Content[nFindIndex].Get_ParaContentPosByXY(SearchPos, Depth + 1, _CurLine, _CurRange, StepEnd); var bResult = this.Content[nFindIndex].Get_ParaContentPosByXY(SearchPos, Depth + 1, _CurLine, _CurRange, StepEnd);
if(true === bResult) if(true === bResult)
{ {
SearchPos.Pos.Update2(nFindIndex, Depth); SearchPos.Pos.Update2(nFindIndex, Depth);
...@@ -1831,8 +1764,6 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth) ...@@ -1831,8 +1764,6 @@ CMathBase.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
var RangeStartPos = this.protected_AddRange(CurLine, CurRange), var RangeStartPos = this.protected_AddRange(CurLine, CurRange),
RangeEndPos = Len - 1; RangeEndPos = Len - 1;
//this.VerifyWordLen(PRS);
if(CurLine == 0 && CurRange == 0) if(CurLine == 0 && CurRange == 0)
{ {
PRS.WordLen += this.BrGapLeft; PRS.WordLen += this.BrGapLeft;
...@@ -1908,11 +1839,6 @@ CMathBase.prototype.Math_GetWidth = function(_CurLine, _CurRange) ...@@ -1908,11 +1839,6 @@ CMathBase.prototype.Math_GetWidth = function(_CurLine, _CurRange)
{ {
return this.size.width; return this.size.width;
}; };
CMathBase.prototype.VerifyWordLen = function(PRS)
{
if(true !== PRS.Word)
PRS.WordLen = 0;
};
CMathBase.prototype.Update_WordLen = function(PRS, WordLen) CMathBase.prototype.Update_WordLen = function(PRS, WordLen)
{ {
if(this.bInside == false) if(this.bInside == false)
...@@ -2083,6 +2009,26 @@ CMathBase.prototype.IsShade = function() ...@@ -2083,6 +2009,26 @@ CMathBase.prototype.IsShade = function()
var oShd = this.Get_CompiledCtrPrp().Shd; var oShd = this.Get_CompiledCtrPrp().Shd;
return !(oShd === undefined || shd_Nil === oShd.Value); return !(oShd === undefined || shd_Nil === oShd.Value);
}; };
CMathBase.prototype.Get_Range_VisibleWidth = function(RangeW, _CurLine, _CurRange)
{
if(this.bOneLine)
{
RangeW.W += 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);
for (var CurPos = StartPos; CurPos <= EndPos; CurPos++ )
{
this.Content[CurPos].Get_Range_VisibleWidth(RangeW, _CurLine, _CurRange);
}
}
};
CMathBase.prototype.Get_CurrentParaPos = CMathContent.prototype.Get_CurrentParaPos; CMathBase.prototype.Get_CurrentParaPos = CMathContent.prototype.Get_CurrentParaPos;
CMathBase.prototype.private_UpdatePosOnAdd = CMathContent.prototype.private_UpdatePosOnAdd; CMathBase.prototype.private_UpdatePosOnAdd = CMathContent.prototype.private_UpdatePosOnAdd;
CMathBase.prototype.private_UpdatePosOnRemove = CMathContent.prototype.private_UpdateOnRemove; CMathBase.prototype.private_UpdatePosOnRemove = CMathContent.prototype.private_UpdateOnRemove;
......
...@@ -1013,7 +1013,9 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page) ...@@ -1013,7 +1013,9 @@ CMathContent.prototype.setPosition = function(pos, PRSA, Line, Range, Page)
this.pos.x = pos.x; this.pos.x = pos.x;
} }
this.Bounds.SetPos(CurLine, this.pos, PRSA); if(this.IsStartRange(Line, Range))
this.Bounds.SetPos(CurLine, this.pos, PRSA);
this.Bounds.SetPage(CurLine, Page); this.Bounds.SetPage(CurLine, Page);
for(var i = StartPos; i <= EndPos; i++) for(var i = StartPos; i <= EndPos; i++)
...@@ -3116,29 +3118,6 @@ CMathContent.prototype.Get_CurrentParaPos = function() ...@@ -3116,29 +3118,6 @@ CMathContent.prototype.Get_CurrentParaPos = function()
return new CParaPos( this.StartRange, this.StartLine, 0, 0 ); return new CParaPos( this.StartRange, this.StartLine, 0, 0 );
}; };
CMathContent.prototype.old_Get_ParaContentPosByXY = function(SearchPos, Depth, _CurLine, _CurRange, StepEnd)
{
var nLength = this.Content.length;
if (nLength <= 0)
return false;
var bResult = false;
for (var nPos = 0; nPos < nLength; nPos++)
{
var CurX = SearchPos.CurX;
if(true === this.Content[nPos].Get_ParaContentPosByXY(SearchPos, Depth + 1, _CurLine, _CurRange, StepEnd))
{
SearchPos.Pos.Update2(nPos, Depth);
bResult = true;
}
SearchPos.CurX = CurX + this.Content[nPos].size.width;
}
return bResult;
};
CMathContent.prototype.Get_ParaContentPos = function(bSelection, bStart, ContentPos) CMathContent.prototype.Get_ParaContentPos = function(bSelection, bStart, ContentPos)
{ {
var nPos = (true !== bSelection ? this.CurPos : (false !== bStart ? this.Selection.Start : this.Selection.End)); var nPos = (true !== bSelection ? this.CurPos : (false !== bStart ? this.Selection.Start : this.Selection.End));
...@@ -4315,16 +4294,18 @@ CMathContent.prototype.Math_Is_End = function(_CurLine, _CurRange) ...@@ -4315,16 +4294,18 @@ CMathContent.prototype.Math_Is_End = function(_CurLine, _CurRange)
return result; return result;
}; };
CMathContent.prototype.IsStartRange = function(Line, Range)
{
var bFirstLine = Line - this.StartLine == 0;
return bFirstLine ? Range - this.StartRange == 0 : Range == 0;
};
CMathContent.prototype.IsStartLine = function(Line) CMathContent.prototype.IsStartLine = function(Line)
{ {
return Line - this.StartLine == 0; return Line == this.StartLine;
}; };
CMathContent.prototype.IsFirstRange = function(Line, Range) CMathContent.prototype.IsFirstRange = function(Line, Range)
{ {
var CurLine = Line - this.StartLine, return Line - this.StartLine == 0 && Range - this.StartRange == 0;
CurRange = Range - this.StartRange;
return CurLine == 0 && CurRange == 0;
}; };
CMathContent.prototype.IsEndLine = function(Line) CMathContent.prototype.IsEndLine = function(Line)
{ {
......
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