Commit 2520a6c4 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander.Trofimov

1) ПОЛНОСТЬЮ изменена отрисовка страниц. Теперь полсекунды (или сразу) будет...

1) ПОЛНОСТЬЮ изменена отрисовка страниц. Теперь полсекунды (или сразу) будет рисоваться старая. А не сразу белая. Разница заметна на зафризеных страницах.
2) включена клавиатура для зафризеных страниц

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@65332 954022d7-b5bf-4e40-9824-e11837661b57
parent 442060fb
...@@ -1006,7 +1006,32 @@ function CDrawingPage() ...@@ -1006,7 +1006,32 @@ function CDrawingPage()
this.bottom = 0; this.bottom = 0;
this.cachedImage = null; this.cachedImage = null;
this.IsRecalculate = false;
this.RecalculateTime = -1;
} }
CDrawingPage.prototype =
{
SetRepaint : function(cache_manager)
{
if (this.cachedImage != null && this.cachedImage.image != null)
{
this.IsRecalculate = true;
if (-1 == this.RecalculateTime)
this.RecalculateTime = new Date().getTime();
return;
}
this.UnLock(cache_manager);
},
UnLock : function(cache_manager)
{
cache_manager.UnLock(this.cachedImage);
this.cachedImage = null;
this.IsRecalculate = false;
this.RecalculateTime = -1;
}
};
function CPage() function CPage()
{ {
...@@ -1849,11 +1874,7 @@ function CDrawingDocument() ...@@ -1849,11 +1874,7 @@ function CDrawingDocument()
if (!page) if (!page)
return; return;
if (null != page.drawingPage.cachedImage) page.drawingPage.SetRepaint(this.m_oCacheManager);
{
this.m_oCacheManager.UnLock(page.drawingPage.cachedImage);
page.drawingPage.cachedImage = null;
}
// перерисовать, если только страница видна на экране // перерисовать, если только страница видна на экране
if (index >= this.m_lDrawingFirst && index <= this.m_lDrawingEnd) if (index >= this.m_lDrawingFirst && index <= this.m_lDrawingEnd)
...@@ -1903,11 +1924,7 @@ function CDrawingDocument() ...@@ -1903,11 +1924,7 @@ function CDrawingDocument()
page.index = index; page.index = index;
if (null != page.drawingPage.cachedImage) page.drawingPage.SetRepaint(this.m_oCacheManager);
{
this.m_oCacheManager.UnLock(page.drawingPage.cachedImage);
page.drawingPage.cachedImage = null;
}
// ������ ���� ��� �������� �� ������ - �� ����� ������� ��������� // ������ ���� ��� �������� �� ������ - �� ����� ������� ���������
if (index >= this.m_lDrawingFirst && index <= this.m_lDrawingEnd) if (index >= this.m_lDrawingFirst && index <= this.m_lDrawingEnd)
...@@ -1931,11 +1948,7 @@ function CDrawingDocument() ...@@ -1931,11 +1948,7 @@ function CDrawingDocument()
for (var index = this.m_lCountCalculatePages; index < this.m_lPagesCount; index++) for (var index = this.m_lCountCalculatePages; index < this.m_lPagesCount; index++)
{ {
var page = this.m_arrPages[index]; var page = this.m_arrPages[index];
if (null != page.drawingPage.cachedImage) page.drawingPage.SetRepaint(this.m_oCacheManager);
{
this.m_oCacheManager.UnLock(page.drawingPage.cachedImage);
page.drawingPage.cachedImage = null;
}
} }
this.m_bIsBreakRecalculate = (isFull === true) ? false : true; this.m_bIsBreakRecalculate = (isFull === true) ? false : true;
...@@ -2025,6 +2038,30 @@ function CDrawingDocument() ...@@ -2025,6 +2038,30 @@ function CDrawingDocument()
this.m_oWordControl.OnScroll(); this.m_oWordControl.OnScroll();
} }
this.CheckRecalculatePage = function(width, height, pageIndex)
{
var _drawingPage = this.m_arrPages[pageIndex].drawingPage;
var isUnlock = false;
if (_drawingPage.cachedImage != null && _drawingPage.cachedImage.image != null && (width != _drawingPage.cachedImage.image.width || height != _drawingPage.cachedImage.image.height))
isUnlock = true;
if (_drawingPage.IsRecalculate)
{
if (this.IsFreezePage(pageIndex))
{
if ((Math.abs(_drawingPage.RecalculateTime - (new Date().getTime())) > 500 /*0.5 sec*/))
isUnlock = true;
}
else
{
isUnlock = true;
}
}
if (isUnlock)
_drawingPage.UnLock(this.m_oCacheManager);
}
this.StartRenderingPage = function(pageIndex) this.StartRenderingPage = function(pageIndex)
{ {
if (true === this.IsFreezePage(pageIndex)) if (true === this.IsFreezePage(pageIndex))
...@@ -2062,6 +2099,7 @@ function CDrawingDocument() ...@@ -2062,6 +2099,7 @@ function CDrawingDocument()
} }
} }
page.drawingPage.UnLock(this.m_oCacheManager);
page.drawingPage.cachedImage = this.m_oCacheManager.Lock(w, h); page.drawingPage.cachedImage = this.m_oCacheManager.Lock(w, h);
//var StartTime = new Date().getTime(); //var StartTime = new Date().getTime();
...@@ -2181,18 +2219,17 @@ function CDrawingDocument() ...@@ -2181,18 +2219,17 @@ function CDrawingDocument()
{ {
if (null != this.m_oDocumentRenderer) if (null != this.m_oDocumentRenderer)
this.m_oDocumentRenderer.stopRenderingPage(pageIndex); this.m_oDocumentRenderer.stopRenderingPage(pageIndex);
if (null != this.m_arrPages[pageIndex].drawingPage.cachedImage)
{ this.m_arrPages[pageIndex].drawingPage.UnLock(this.m_oCacheManager);
this.m_oCacheManager.UnLock(this.m_arrPages[pageIndex].drawingPage.cachedImage);
this.m_arrPages[pageIndex].drawingPage.cachedImage = null;
}
} }
this.ClearCachePages = function() this.ClearCachePages = function()
{ {
for (var i = 0; i < this.m_lPagesCount; i++) for (var i = 0; i < this.m_lPagesCount; i++)
{ {
this.StopRenderingPage(i); var page = this.m_arrPages[i];
if (page)
page.drawingPage.SetRepaint(this.m_oCacheManager);
} }
} }
......
...@@ -2372,11 +2372,13 @@ function CEditorPage(api) ...@@ -2372,11 +2372,13 @@ function CEditorPage(api)
} }
return; return;
} }
/*
if (oWordControl.m_oDrawingDocument.IsFreezePage(oWordControl.m_oDrawingDocument.m_lCurrentPage)) if (oWordControl.m_oDrawingDocument.IsFreezePage(oWordControl.m_oDrawingDocument.m_lCurrentPage))
{ {
e.preventDefault(); e.preventDefault();
return; return;
} }
*/
/* /*
if (oWordControl.m_oApi.isViewMode) if (oWordControl.m_oApi.isViewMode)
{ {
...@@ -2603,8 +2605,10 @@ function CEditorPage(api) ...@@ -2603,8 +2605,10 @@ function CEditorPage(api)
return; return;
} }
/*
if (oWordControl.m_oDrawingDocument.IsFreezePage(oWordControl.m_oDrawingDocument.m_lCurrentPage)) if (oWordControl.m_oDrawingDocument.IsFreezePage(oWordControl.m_oDrawingDocument.m_lCurrentPage))
return; return;
*/
check_KeyboardEvent(e); check_KeyboardEvent(e);
...@@ -3422,25 +3426,26 @@ function CEditorPage(api) ...@@ -3422,25 +3426,26 @@ function CEditorPage(api)
this.m_oDrawingDocument.StopRenderingPage(i); this.m_oDrawingDocument.StopRenderingPage(i);
} }
if (null == drawPage.cachedImage) var __x = drawPage.left;
var __y = drawPage.top;
var __w = drawPage.right - __x;
var __h = drawPage.bottom - __y;
if (this.bIsRetinaSupport)
{ {
this.m_oDrawingDocument.StartRenderingPage(i); __x <<= 1;
__y <<= 1;
__w <<= 1;
__h <<= 1;
} }
if (!this.bIsRetinaSupport) this.m_oDrawingDocument.CheckRecalculatePage(__w, __h, i);
{ if (null == drawPage.cachedImage)
this.m_oDrawingDocument.m_arrPages[i].Draw(context, drawPage.left, drawPage.top, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top);
//this.m_oBoundsController.CheckRect(drawPage.left, drawPage.top, drawPage.right - drawPage.left, drawPage.bottom - drawPage.top);
}
else
{ {
var __x = drawPage.left << 1; this.m_oDrawingDocument.StartRenderingPage(i);
var __y = drawPage.top << 1;
var __w = (drawPage.right << 1) - __x;
var __h = (drawPage.bottom << 1) - __y;
this.m_oDrawingDocument.m_arrPages[i].Draw(context, __x, __y, __w, __h);
//this.m_oBoundsController.CheckRect(__x, __y, __w, __h);
} }
this.m_oDrawingDocument.m_arrPages[i].Draw(context, __x, __y, __w, __h);
//this.m_oBoundsController.CheckRect(__x, __y, __w, __h);
} }
} }
......
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