Commit cb944de1 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@58650 954022d7-b5bf-4e40-9824-e11837661b57
parent 960132dd
......@@ -1692,7 +1692,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 } };
this.MathRect = { IsActive : false, Rect : { X : 0, Y : 0, R : 0, B : 0, PageIndex : 0 }, ContentSelection : null };
this.m_oCacheManager = new CCacheManager();
......@@ -3359,6 +3359,35 @@ function CDrawingDocument()
this.AutoShapesTrack.AddRect(ctx, (_x - 1) >> 0, (_y - 1) >> 0, (_r + 1) >> 0, (_b + 1) >> 0);
ctx.stroke();
ctx.beginPath();
if (null !== this.MathRect.ContentSelection)
{
var _x = (drPage.left + dKoefX * this.MathRect.ContentSelection.X);
var _y = (drPage.top + dKoefY * this.MathRect.ContentSelection.Y);
var _r = (drPage.left + dKoefX * (this.MathRect.ContentSelection.X + this.MathRect.ContentSelection.W));
var _b = (drPage.top + dKoefY * (this.MathRect.ContentSelection.Y + this.MathRect.ContentSelection.H));
if (_x < overlay.min_x)
overlay.min_x = _x;
if (_r > overlay.max_x)
overlay.max_x = _r;
if (_y < overlay.min_y)
overlay.min_y = _y;
if (_b > overlay.max_y)
overlay.max_y = _b;
var ctx = overlay.m_oContext;
ctx.fillStyle = "#939393";
ctx.beginPath();
this.AutoShapesTrack.AddRect(ctx, _x >> 0, _y >> 0, _r >> 0, _b >> 0);
ctx.globalAlpha = 0.2;
ctx.fill();
ctx.globalAlpha = 1;
ctx.beginPath();
}
}
this.DrawTableTrack = function(overlay)
......@@ -4176,16 +4205,21 @@ function CDrawingDocument()
this.m_oWordControl.UpdateVerRuler();
}
this.Update_MathTrack = function(IsActive, X, Y, W, H, PageIndex)
this.Update_MathTrack = function(IsActive, Math, X, Y, W, H, PageIndex)
{
this.MathRect.IsActive = IsActive;
if (true === IsActive)
{
this.MathRect.Rect.X = X;
this.MathRect.Rect.Y = Y;
this.MathRect.Rect.R = X + W;
this.MathRect.Rect.B = Y + H;
if (null !== Math)
this.MathRect.ContentSelection = Math.Get_ContentSelection();
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;
}
}
......
......@@ -373,12 +373,19 @@ ParaMath.prototype.GetSelectContent = function()
ParaMath.prototype.Get_CurrentParaPos = function()
{
//var CurPos = this.State.ContentPos;
/*if ( CurPos >= 0 && CurPos < this.Content.length )
return this.Content[CurPos].Get_CurrentParaPos();*/
var nLinesCount = this.protected_GetLinesCount();
for (var nLineIndex = 0; nLineIndex < nLinesCount; nLineIndex++)
{
var nRangesCount = this.protected_GetRangesCount(nLineIndex);
for (var nRangeIndex = 0; nRangeIndex < nRangesCount; nRangeIndex++)
{
var nEndPos = this.protected_GetRangeEndPos(nLineIndex, nRangeIndex);
if (nEndPos > 0)
return new CParaPos(0 === nLineIndex ? this.StartRange + nRangeIndex : nRangeIndex, this.StartLine + nLineIndex, 0, 0);
}
}
return new CParaPos( this.StartRange, this.StartLine, 0, 0 );
return new CParaPos(this.StartRange, this.StartLine, 0, 0);
};
ParaMath.prototype.Apply_TextPr = function(TextPr, IncFontSize, ApplyToAll)
......@@ -1579,4 +1586,14 @@ ParaMath.prototype.Read_FromBinary2 = function(Reader)
Element.bRoot = true;
this.Root = Element;
};
ParaMath.prototype.Get_ContentSelection = function()
{
var oContent = this.GetSelectContent().Content;
if (oContent.bRoot || true === this.bSelectionUse)
return null;
return {X : oContent.pos.x + this.X, Y : oContent.pos.y + this.Y, W : oContent.size.width, H : oContent.size.height};
};
\ No newline at end of file
......@@ -8372,11 +8372,8 @@ Paragraph.prototype =
editor.sync_HyperlinkPropCallback( HyperProps );
}
if ( null !== Math )
{
var PixelError = editor.WordControl.m_oLogicDocument.DrawingDocument.GetMMPerDot(1) * 3;
this.Parent.DrawingDocument.Update_MathTrack(true, Math.X - PixelError, Math.Y - PixelError, Math.Width + 2 * PixelError, Math.Height + 2 * PixelError, this.CurPos.PagesPos + this.Get_StartPage_Absolute());
}
if (null !== Math)
this.Parent.DrawingDocument.Update_MathTrack(true, Math, Math.X, Math.Y, Math.Width, Math.Height, this.CurPos.PagesPos + this.Get_StartPage_Absolute());
else
this.Parent.DrawingDocument.Update_MathTrack(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