Commit 7201d6d9 authored by Oleg Korshul's avatar Oleg Korshul

check idle

parent c19772ec
......@@ -169,6 +169,8 @@
this.isLockTargetUpdate = false;
this.lastWorkTime = 0;
return this;
}
......@@ -1306,6 +1308,27 @@
{
};
baseEditorsApi.prototype.isIdle = function(time)
{
// пока не стартовали - считаем работаем
if (0 == this.lastWorkTime)
return false;
// если плагин работает - то и мы тоже
if (this.pluginsManager && this.pluginsManager.current != null)
return false;
var _currentTime = new Date().getTime();
return ((_currentTime - this.lastWorkTime) > time) ? true : false;
};
baseEditorsApi.prototype.checkLastWork = function()
{
this.lastWorkTime = new Date().getTime();
console.log(this.lastWorkTime);
};
//----------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].baseEditorsApi = baseEditorsApi;
......
......@@ -1007,6 +1007,8 @@ function CDrawingDocument()
this.OnStartRecalculate = function(pageCount)
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
}
this.SetTargetColor = function(r, g, b)
......@@ -1083,6 +1085,9 @@ function CDrawingDocument()
this.OnEndRecalculate = function()
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
this.m_oWordControl.Thumbnails.LockMainObjType = true;
this.SlidesCount = this.m_oLogicDocument.Slides.length;
this.m_oWordControl.CalculateDocumentSize();
......@@ -1870,6 +1875,9 @@ function CDrawingDocument()
this.UpdateTarget = function(x, y, pageIndex)
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
this.m_oWordControl.m_oLogicDocument.Set_TargetPos(x, y, pageIndex);
if (pageIndex != this.SlideCurrent)
{
......@@ -3378,6 +3386,9 @@ function CThumbnailsManager()
this.onMouseDown = function(e)
{
if (oThis.m_oWordControl)
oThis.m_oWordControl.m_oApi.checkLastWork();
if (e.preventDefault)
e.preventDefault();
else
......@@ -3619,6 +3630,9 @@ function CThumbnailsManager()
this.onMouseMove = function(e)
{
if (oThis.m_oWordControl)
oThis.m_oWordControl.m_oApi.checkLastWork();
var control = oThis.m_oWordControl.m_oThumbnails.HtmlElement;
if (global_mouseEvent.IsLocked == true && global_mouseEvent.Sender != control)
{
......@@ -3773,6 +3787,9 @@ function CThumbnailsManager()
this.onMouseUp = function(e)
{
if (oThis.m_oWordControl)
oThis.m_oWordControl.m_oApi.checkLastWork();
AscCommon.check_MouseUpEvent(e);
global_mouseEvent.UnLockMouse();
......@@ -4278,6 +4295,9 @@ function CThumbnailsManager()
if (null == canvas)
return;
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
var context = canvas.getContext("2d");
var _width = canvas.width;
var _height = canvas.height;
......
......@@ -1633,6 +1633,8 @@ function CEditorPage(api)
this.onMouseDown = function(e)
{
oThis.m_oApi.checkLastWork();
if (false === oThis.m_oApi.bInit_word_control)
return;
......@@ -1713,6 +1715,8 @@ function CEditorPage(api)
this.onMouseMove = function(e)
{
oThis.m_oApi.checkLastWork();
if (false === oThis.m_oApi.bInit_word_control)
return;
......@@ -1760,6 +1764,8 @@ function CEditorPage(api)
};
this.onMouseUp = function(e, bIsWindow)
{
oThis.m_oApi.checkLastWork();
if (false === oThis.m_oApi.bInit_word_control)
return;
//if (true == global_mouseEvent.IsLocked)
......@@ -1975,6 +1981,8 @@ function CEditorPage(api)
this.onKeyDown = function(e)
{
oThis.m_oApi.checkLastWork();
if (oThis.m_oApi.isLongAction())
{
e.preventDefault();
......@@ -2630,6 +2638,8 @@ function CEditorPage(api)
return false;
}
this.m_oApi.checkLastWork();
var overlay = this.m_oOverlayApi;
overlay.SetBaseTransform();
......
......@@ -2177,6 +2177,9 @@ function CDrawingDocument()
this.OnStartRecalculate = function (pageCount)
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
this.m_lCountCalculatePages = pageCount;
//console.log("start " + this.m_lCountCalculatePages);
......@@ -2186,6 +2189,9 @@ function CDrawingDocument()
this.OnRepaintPage = function (index)
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
var page = this.m_arrPages[index];
if (!page)
return;
......@@ -2256,6 +2262,9 @@ function CDrawingDocument()
this.OnEndRecalculate = function (isFull, isBreak)
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
if (undefined != isBreak)
{
this.m_lCountCalculatePages = this.m_lPagesCount;
......@@ -3219,6 +3228,9 @@ function CDrawingDocument()
this.UpdateTarget = function (x, y, pageIndex)
{
if (this.m_oWordControl)
this.m_oWordControl.m_oApi.checkLastWork();
this.m_oWordControl.m_oLogicDocument.Set_TargetPos(x, y, pageIndex);
if (this.UpdateTargetFromPaint === false)
......
......@@ -1514,6 +1514,8 @@ function CEditorPage(api)
this.onMouseDown = function(e, isTouch)
{
oThis.m_oApi.checkLastWork();
//console.log("down: " + isTouch + ", " + AscCommon.isTouch);
if (false === oThis.m_oApi.bInit_word_control || (AscCommon.isTouch && undefined === isTouch))
return;
......@@ -1617,6 +1619,8 @@ function CEditorPage(api)
this.onMouseMove = function(e, isTouch)
{
oThis.m_oApi.checkLastWork();
if (false === oThis.m_oApi.bInit_word_control || (AscCommon.isTouch && undefined === isTouch))
return;
......@@ -1703,6 +1707,8 @@ function CEditorPage(api)
};
this.onMouseUp = function(e, bIsWindow, isTouch)
{
oThis.m_oApi.checkLastWork();
//console.log("up: " + isTouch + ", " + AscCommon.isTouch);
if (false === oThis.m_oApi.bInit_word_control || (AscCommon.isTouch && undefined === isTouch))
return;
......@@ -2277,6 +2283,8 @@ function CEditorPage(api)
this.onKeyDown = function(e)
{
oThis.m_oApi.checkLastWork();
if (oThis.m_oApi.isLongAction())
{
e.preventDefault();
......@@ -2825,6 +2833,9 @@ function CEditorPage(api)
this.IsUpdateOverlayOnEndCheck = true;
return false;
}
this.m_oApi.checkLastWork();
//console.log("update_overlay");
var overlay = this.m_oOverlayApi;
//if (!overlay.m_bIsShow)
......@@ -3151,12 +3162,18 @@ function CEditorPage(api)
this.OnPaint = function()
{
if (this.DrawingFreeze || true === window["DisableVisibleComponents"])
{
this.m_oApi.checkLastWork();
return;
}
//console.log("paint");
var canvas = this.m_oEditor.HtmlElement;
if (null == canvas)
{
this.m_oApi.checkLastWork();
return;
}
var context = canvas.getContext("2d");
context.fillStyle = GlobalSkin.BackgroundColor;
......
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