Commit a3e58879 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Сделана отрисовка рамок и выделений контента для многострочных формуд.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@62214 954022d7-b5bf-4e40-9824-e11837661b57
parent 7529d1bf
......@@ -1682,7 +1682,7 @@ function CDrawingDocument()
this.FrameRect = { IsActive : false, Rect : { X : 0, Y : 0, R : 0, B : 0 }, Frame : null,
Track : { X : 0, Y : 0, L : 0, T : 0, R : 0, B : 0, PageIndex : 0, Type : -1 }, IsTracked : false, PageIndex : 0 };
this.MathRect = { IsActive : false, Rect : { X : 0, Y : 0, R : 0, B : 0, PageIndex : 0 }, ContentSelection : null };
this.MathRect = { IsActive : false, Bounds : [], ContentSelection : null };
this.FieldTrack = {IsActive : false, Rects : []};
this.m_oCacheManager = new CCacheManager();
......@@ -3321,18 +3321,21 @@ function CDrawingDocument()
overlay.Show();
var _page = this.m_arrPages[this.MathRect.Rect.PageIndex];
if (null == this.TextMatrix || global_MatrixTransformer.IsIdentity(this.TextMatrix))
{
for (var nIndex = 0, nCount = this.MathRect.Bounds.length; nIndex < nCount; nIndex++)
{
var oBounds = this.MathRect.Bounds[nIndex];
var _page = this.m_arrPages[oBounds.Page];
var drPage = _page.drawingPage;
var dKoefX = (drPage.right - drPage.left) / _page.width_mm;
var dKoefY = (drPage.bottom - drPage.top) / _page.height_mm;
if (null == this.TextMatrix || global_MatrixTransformer.IsIdentity(this.TextMatrix))
{
var _x = (drPage.left + dKoefX * this.MathRect.Rect.X);
var _y = (drPage.top + dKoefY * this.MathRect.Rect.Y);
var _r = (drPage.left + dKoefX * this.MathRect.Rect.R);
var _b = (drPage.top + dKoefY * this.MathRect.Rect.B);
var _x = (drPage.left + dKoefX * oBounds.X);
var _y = (drPage.top + dKoefY * oBounds.Y);
var _r = (drPage.left + dKoefX * oBounds.R);
var _b = (drPage.top + dKoefY * oBounds.B);
if (_x < overlay.min_x)
overlay.min_x = _x;
......@@ -3360,13 +3363,23 @@ function CDrawingDocument()
this.AutoShapesTrack.AddRect(ctx, (_x - 1) >> 0, (_y - 1) >> 0, (_r + 1) >> 0, (_b + 1) >> 0, true);
ctx.stroke();
ctx.beginPath();
}
if (null !== this.MathRect.ContentSelection)
{
_x = (drPage.left + dKoefX * this.MathRect.ContentSelection.X);
_y = (drPage.top + dKoefY * this.MathRect.ContentSelection.Y);
_r = (drPage.left + dKoefX * (this.MathRect.ContentSelection.X + this.MathRect.ContentSelection.W));
_b = (drPage.top + dKoefY * (this.MathRect.ContentSelection.Y + this.MathRect.ContentSelection.H));
for (var nIndex = 0, nCount = this.MathRect.ContentSelection.length; nIndex < nCount; nIndex++)
{
var oContentSelection = this.MathRect.ContentSelection[nIndex];
var _page = this.m_arrPages[oContentSelection.Page];
var drPage = _page.drawingPage;
var dKoefX = (drPage.right - drPage.left) / _page.width_mm;
var dKoefY = (drPage.bottom - drPage.top) / _page.height_mm;
_x = (drPage.left + dKoefX * oContentSelection.X);
_y = (drPage.top + dKoefY * oContentSelection.Y);
_r = (drPage.left + dKoefX * (oContentSelection.X + oContentSelection.W));
_b = (drPage.top + dKoefY * (oContentSelection.Y + oContentSelection.H));
if (_x < overlay.min_x)
overlay.min_x = _x;
......@@ -3390,16 +3403,26 @@ function CDrawingDocument()
ctx.beginPath();
}
}
}
else
{
for (var nIndex = 0, nCount = this.MathRect.Bounds.length; nIndex < nCount; nIndex++)
{
var oBounds = this.MathRect.Bounds[nIndex];
var _page = this.m_arrPages[oBounds.Page];
var drPage = _page.drawingPage;
var dKoefX = (drPage.right - drPage.left) / _page.width_mm;
var dKoefY = (drPage.bottom - drPage.top) / _page.height_mm;
var _arrBorderBlack = TransformRectByMatrix(this.TextMatrix,
[this.MathRect.Rect.X, this.MathRect.Rect.Y, this.MathRect.Rect.R, this.MathRect.Rect.B],
[oBounds.X, oBounds.Y, oBounds.R, oBounds.B],
drPage.left, drPage.top, dKoefX, dKoefY);
var _1px_mm_x = 1 / Math.max(dKoefX, 0.001);
var _1px_mm_y = 1 / Math.max(dKoefY, 0.001);
var _arrBorderWhite = TransformRectByMatrix(this.TextMatrix,
[this.MathRect.Rect.X - _1px_mm_x, this.MathRect.Rect.Y - _1px_mm_y, this.MathRect.Rect.R - _1px_mm_x, this.MathRect.Rect.B - _1px_mm_y],
[oBounds.X - _1px_mm_x, oBounds.Y - _1px_mm_y, oBounds.R - _1px_mm_x, oBounds.B - _1px_mm_y],
drPage.left, drPage.top, dKoefX, dKoefY);
overlay.CheckPoint(_arrBorderWhite[0], _arrBorderWhite[1]);
......@@ -3435,13 +3458,23 @@ function CDrawingDocument()
ctx.stroke();
ctx.beginPath();
}
if (null !== this.MathRect.ContentSelection)
{
for (var nIndex = 0, nCount = this.MathRect.ContentSelection.length; nIndex < nCount; nIndex++)
{
var oContentSelection = this.MathRect.ContentSelection[nIndex];
var _page = this.m_arrPages[oContentSelection.Page];
var drPage = _page.drawingPage;
var dKoefX = (drPage.right - drPage.left) / _page.width_mm;
var dKoefY = (drPage.bottom - drPage.top) / _page.height_mm;
var _arrSelect = TransformRectByMatrix(this.TextMatrix,
[this.MathRect.ContentSelection.X, this.MathRect.ContentSelection.Y,
this.MathRect.ContentSelection.X + this.MathRect.ContentSelection.W,
this.MathRect.ContentSelection.Y + this.MathRect.ContentSelection.H],
[oContentSelection.X, oContentSelection.Y,
oContentSelection.X + oContentSelection.W,
oContentSelection.Y + oContentSelection.H],
drPage.left, drPage.top, dKoefX, dKoefY);
overlay.CheckPoint(_arrSelect[0], _arrSelect[1]);
......@@ -3465,8 +3498,7 @@ function CDrawingDocument()
ctx.globalAlpha = 1;
ctx.beginPath();
}
}
}
}
......@@ -4556,24 +4588,34 @@ function CDrawingDocument()
this.m_oWordControl.UpdateVerRuler();
}
this.Update_MathTrack = function(IsActive, IsContentActive, Math, X, Y, W, H, PageIndex)
this.Update_MathTrack = function(IsActive, IsContentActive, Math)
{
this.MathRect.IsActive = IsActive;
if (true === IsActive)
if (true === IsActive && null !== Math)
{
if (null !== Math && true === IsContentActive)
if (true === IsContentActive)
this.MathRect.ContentSelection = Math.Get_ContentSelection();
else
this.MathRect.ContentSelection = null;
var PixelError = this.GetMMPerDot(1) * 3;
this.MathRect.Rect.X = X - PixelError;
this.MathRect.Rect.Y = Y - PixelError;
this.MathRect.Rect.R = X + W + PixelError;
this.MathRect.Rect.B = Y + H + PixelError;
this.MathRect.Rect.PageIndex = PageIndex;
var arrBounds = Math.Get_Bounds();
this.MathRect.Bounds = [];
for (var nIndex = 0, nCount = arrBounds.length; nIndex < nCount; nIndex++)
{
var oBounds = arrBounds[nIndex];
this.MathRect.Bounds[nIndex] =
{
X : oBounds.X - PixelError,
Y : oBounds.Y - PixelError,
R : oBounds.X + oBounds.W + PixelError,
B : oBounds.Y + oBounds.H + PixelError,
Page : oBounds.Page
};
}
}
}
......
......@@ -12042,10 +12042,7 @@ CDocument.prototype =
var oSelectedInfo = this.Get_SelectedElementsInfo();
var Math = oSelectedInfo.Get_Math();
if (null !== Math)
{
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);
}
this.DrawingDocument.Update_MathTrack(true, (false === bSelection || true === bEmptySelection ? true : false), Math);
else
this.DrawingDocument.Update_MathTrack(false);
......
......@@ -1824,10 +1824,7 @@ ParaMath.prototype.Get_ContentSelection = function()
return null;
var Bounds = oContent.Get_Bounds();
var LinesCount = oContent.protected_GetLinesCount();
return Bounds[0];
return Bounds;
};
ParaMath.prototype.Recalc_RunsCompiledPr = function()
......@@ -1969,14 +1966,9 @@ ParaMath.prototype.Make_AutoCorrect = function()
ParaMath.prototype.Get_Bounds = function()
{
if (undefined === this.Paragraph || null === this.Paragraph)
return {X : 0, Y : 0, W : 0, H : 0, Page : 0};
return [{X : 0, Y : 0, W : 0, H : 0, Page : 0}];
else
{
var LinesCount = this.Root.protected_GetLinesCount();
return this.Root.Get_Bounds()[LinesCount - 1];
}
return this.Root.Get_Bounds();
};
ParaMath.prototype.getPropsForWrite = function()
......
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