Commit 7ada290a authored by Ilya.Kirillov's avatar Ilya.Kirillov

Сделано, чтобы рект вокруг формулы рисовался правильного размера для формул,...

Сделано, чтобы рект вокруг формулы рисовался правильного размера для формул, размещенной в первой и/или последней строках параграфа. 

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@59036 954022d7-b5bf-4e40-9824-e11837661b57
parent 3aa397c3
......@@ -11885,7 +11885,10 @@ CDocument.prototype =
var oSelectedInfo = this.Get_SelectedElementsInfo();
var Math = oSelectedInfo.Get_Math();
if (null !== Math)
this.DrawingDocument.Update_MathTrack(true, (false === bSelection || true === bEmptySelection ? true : false), Math, Math.X, Math.Y, Math.Width, Math.Height, Math.Paragraph.CurPos.PagesPos + Math.Paragraph.Get_StartPage_Absolute());
{
var Bounds = Math.Get_Bounds();
this.DrawingDocument.Update_MathTrack(true, (false === bSelection || true === bEmptySelection ? true : false), Math, Bounds.X, Bounds.Y, Bounds.W, Bounds.H, Bounds.Page);
}
else
this.DrawingDocument.Update_MathTrack(false);
},
......
......@@ -1576,6 +1576,28 @@ ParaMath.prototype.Make_AutoCorrect = function()
return false;
};
/**
* Получаем рект формулы
* @constructor
*/
ParaMath.prototype.Get_Bounds = function()
{
if (undefined === this.Paragraph || null === this.Paragraph)
return {X : this.X, Y : this.Y, W : this.Width, H : this.Height, Page : 0};
else
{
var LinesCount = this.protected_GetLinesCount();
var CurLine = this.StartLine + LinesCount - 1;
var CurPage = this.Paragraph.Get_PageByLine(CurLine);
var Y = this.Paragraph.Pages[CurPage].Y + this.Paragraph.Lines[CurLine].Top;
var H = this.Paragraph.Lines[CurLine].Bottom - this.Paragraph.Lines[CurLine].Top;
return {X : this.X, Y : Y, W : this.Width, H : H, Page : this.Paragraph.Get_StartPage_Absolute() + CurPage};
}
};
//----------------------------------------------------------------------------------------------------------------------
// Классы с изменениями
......
......@@ -738,21 +738,21 @@ Paragraph.prototype =
ParaPos.Range = this.CurPos.Range;
}
var CurLine = ParaPos.Line;
ParaPos.Page = this.Get_PageByLine(ParaPos.Line);
// Определим страницу
var PagesCount = this.Pages.length;
for ( var CurPage = PagesCount - 1; CurPage >= 0; CurPage-- )
return ParaPos;
},
Get_PageByLine : function(LineIndex)
{
for (var CurPage = this.Pages.length - 1; CurPage >= 0; CurPage--)
{
var Page = this.Pages[CurPage];
if ( CurLine >= Page.StartLine && CurLine <= Page.EndLine )
{
ParaPos.Page = CurPage;
return ParaPos;
}
if (LineIndex >= Page.StartLine && LineIndex <= Page.EndLine)
return CurPage;
}
return ParaPos;
return 0;
},
Get_ParaPosByContentPos : function(ContentPos)
......
......@@ -896,10 +896,23 @@ CMathBase.prototype.Get_ParaContentPos = function(bSelection, bStart, ContentPos
};
CMathBase.prototype.Set_ParaContentPos = function(ContentPos, Depth)
{
this.CurPos = ContentPos.Get(Depth);
var CurPos = ContentPos.Get(Depth);
if (undefined !== this.Content[this.CurPos])
if (CurPos > this.Content.length - 1)
{
this.CurPos = this.Content.length - 1;
this.Content[this.CurPos].Cursor_MoveToEndPos(false);
}
else if (this.CurPos < 0)
{
this.CurPos = 0;
this.Content[this.CurPos].Cursor_MoveToStartPos();
}
else
{
this.CurPos = CurPos;
this.Content[this.CurPos].Set_ParaContentPos(ContentPos, Depth + 1);
}
};
CMathBase.prototype.Selection_IsEmpty = function()
{
......
......@@ -3881,7 +3881,7 @@ CMathContent.prototype.Set_ParaContentPos = function(ContentPos, Depth)
// Делаем такие проверки, потому что после совместного редактирования, позиция может остаться старой, а
// контент измениться.
if (CurPos >= this.content.length - 1)
if (CurPos > this.content.length - 1)
{
this.CurPos = this.content.length - 1;
this.content[this.CurPos].Cursor_MoveToEndPos(false);
......
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