Commit d69ee964 authored by Alexander.Trofimov's avatar Alexander.Trofimov

cell/view/mobileTouch to function-closure

cell/view/mobileTouch prototype = {} -> .prototype.
parent a6252df8
......@@ -714,7 +714,7 @@
};
if (this.Api.isMobileVersion) {
this.MobileTouchManager = new CMobileTouchManager();
this.MobileTouchManager = new AscCommonExcel.CMobileTouchManager();
this.MobileTouchManager.Init(this);
}
return this;
......
......@@ -30,6 +30,12 @@
* To change this template use File | Settings | File Templates.
*/
"use strict";
(
/**
* @param {Window} window
* @param {undefined} undefined
*/
function (window, undefined) {
function CMobileTouchManager()
{
this.AnimateScroll = false;
......@@ -97,17 +103,16 @@ function CMobileTouchManager()
this.canZoom = true;
this.wasMove = false;
}
CMobileTouchManager.prototype = {
Init : function(ctrl)
{
CMobileTouchManager.prototype.Init = function(ctrl)
{
this.ctrl = ctrl;
this.iScroll = new window.CTouchScroll(ctrl,{hScrollbar:true,vScrollbar:true,momentum:false}/*, { onAnimationEnd : function(param) {
param.api.MobileTouchManager.OnScrollAnimationEnd();
} }*/);
},
};
MoveCursorToPoint : function(e)
{
CMobileTouchManager.prototype.MoveCursorToPoint = function(e)
{
check_MouseMoveEvent(e);
var pos = this.DrawingDocument.ConvertCoordsFromCursor2(global_mouseEvent.X, global_mouseEvent.Y);
......@@ -122,10 +127,10 @@ CMobileTouchManager.prototype = {
this.DrawingDocument.NeedScrollToTargetFlag = false;
global_mouseEvent.ClickCount = old_click_count;
},
};
onTouchStart : function(e)
{
CMobileTouchManager.prototype.onTouchStart = function(e)
{
this.longTapFlag = true;
this.wasMove = false;
var thas = this, evt = e,
......@@ -152,7 +157,7 @@ CMobileTouchManager.prototype = {
// global_mouseEvent.LockMouse();
// this.HtmlPage.m_oApi.asc_fireCallback("asc_onHidePopMenu");
/* this.ScrollH = this.HtmlPage.m_dScrollX;
/* this.ScrollH = this.HtmlPage.m_dScrollX;
this.ScrollV = this.HtmlPage.m_dScrollY;
this.TableCurrentMoveValueMin = null;
......@@ -167,7 +172,7 @@ CMobileTouchManager.prototype = {
_matrix = null;*/
// проверим на попадание в селект - это может произойти на любом mode
/* if (null != this.RectSelect1 && null != this.RectSelect2)
/* if (null != this.RectSelect1 && null != this.RectSelect2)
{
var pos1 = null;
var pos4 = null;
......@@ -601,9 +606,9 @@ CMobileTouchManager.prototype = {
e.returnValue = false;
return false;
}*/
},
onTouchMove : function(e)
{
};
CMobileTouchManager.prototype.onTouchMove = function(e)
{
this.longTapFlag = false;
this.wasMove = true;
// clearInterval(this.longTapTimer);
......@@ -679,14 +684,14 @@ CMobileTouchManager.prototype = {
this.iScroll._move(e);
// if (_offsetX != 0 && this.HtmlPage.m_dScrollX_max > 0)
// {
// this.HtmlPage.m_oScrollHorApi.scrollToX(this.ScrollH - _offsetX);
// }
// if (_offsetY != 0 && this.HtmlPage.m_dScrollY_max > 0)
// {
// this.HtmlPage.m_oScrollVerApi.scrollToY(this.ScrollV - _offsetY);
// }
// if (_offsetX != 0 && this.HtmlPage.m_dScrollX_max > 0)
// {
// this.HtmlPage.m_oScrollHorApi.scrollToX(this.ScrollH - _offsetX);
// }
// if (_offsetY != 0 && this.HtmlPage.m_dScrollY_max > 0)
// {
// this.HtmlPage.m_oScrollVerApi.scrollToY(this.ScrollV - _offsetY);
// }
e.preventDefault();
e.returnValue = false;
......@@ -803,19 +808,19 @@ CMobileTouchManager.prototype = {
default:
break;
}*/
},
onTouchEnd : function(e)
{
};
CMobileTouchManager.prototype.onTouchEnd = function(e)
{
this.longTapFlag = false;
// clearInterval(this.longTapTimer);
this.iScroll._end(e);
var now = new Date().getTime(), point = e.changedTouches ? e.changedTouches[0] : e;
/* this.mylatesttap = this.mylatesttap||now+1
/* this.mylatesttap = this.mylatesttap||now+1
var timesince = now - this.mylatesttap;
if((timesince < 300) && (timesince > 0)){
// this.ctrl.handlers.trigger("asc_onDoubleTapEvent",e);
// this.ctrl.handlers.trigger("asc_onDoubleTapEvent",e);
this.mylatesttap = null;
if ( this.wasZoom ) {
this.zoomFactor = 1;
......@@ -841,7 +846,7 @@ CMobileTouchManager.prototype = {
e.returnValue = false;
this.wasMove = false;
return;
/*
/*
if (null != this.DrawingDocument.m_oDocumentRenderer)
return this.onTouchEnd_renderer(e);
......@@ -1023,10 +1028,10 @@ CMobileTouchManager.prototype = {
// если есть селект - то показать меню
this.CheckSelectEnd(true);*/
},
};
onTouchStart_renderer : function(e)
{
CMobileTouchManager.prototype.onTouchStart_renderer = function(e)
{
check_MouseDownEvent(e.touches ? e.touches[0] : e, true);
global_mouseEvent.LockMouse();
......@@ -1086,9 +1091,9 @@ CMobileTouchManager.prototype = {
e.preventDefault();
else
e.returnValue = false;
},
onTouchMove_renderer : function(e)
{
};
CMobileTouchManager.prototype.onTouchMove_renderer = function(e)
{
check_MouseMoveEvent(e.touches ? e.touches[0] : e);
if (!this.MoveAfterDown)
......@@ -1150,9 +1155,9 @@ CMobileTouchManager.prototype = {
e.preventDefault();
else
e.returnValue = false;
},
onTouchEnd_renderer : function(e)
{
};
CMobileTouchManager.prototype.onTouchEnd_renderer = function(e)
{
check_MouseUpEvent(e.changedTouches ? e.changedTouches[0] : e);
this.ScrollH = this.HtmlPage.m_dScrollX;
......@@ -1192,10 +1197,10 @@ CMobileTouchManager.prototype = {
e.preventDefault();
else
e.returnValue = false;
},
};
CheckSelectEnd : function(bIsAttack)
{
CMobileTouchManager.prototype.CheckSelectEnd = function(bIsAttack)
{
var _bIsRet = false;
if (!bIsAttack)
_bIsRet = this.IsTrackingCurrent;
......@@ -1233,10 +1238,10 @@ CMobileTouchManager.prototype = {
if (!this.iScroll.animating)
this.SendShowMenu(_x, _y);
}
},
};
CheckZoomCriticalValues : function(zoomMin)
{
CMobileTouchManager.prototype.CheckZoomCriticalValues = function(zoomMin)
{
if (zoomMin !== undefined)
{
this.ZoomValueMin = zoomMin;
......@@ -1271,26 +1276,26 @@ CMobileTouchManager.prototype = {
this.ZoomValue = this.ZoomValueMin;
this.HtmlPage.m_oApi.zoom(this.ZoomValue);
}
},
};
Resize : function()
{
CMobileTouchManager.prototype.Resize = function()
{
if (this.iScroll != null)
this.iScroll.refresh(true);
},
};
SendShowMenu : function(x, y)
{
CMobileTouchManager.prototype.SendShowMenu = function(x, y)
{
if (-1 != this.ShowMenuTimerId)
{
clearTimeout(this.ShowMenuTimerId);
}
var that = this;
that.ShowMenuTimerId = setTimeout(function(){ that.HtmlPage.m_oApi.asc_fireCallback("asc_onShowPopMenu", x, y); }, 500);
},
};
OnScrollAnimationEnd : function()
{
CMobileTouchManager.prototype.OnScrollAnimationEnd = function()
{
if (this.HtmlPage.m_oApi.isViewMode)
return;
......@@ -1322,10 +1327,10 @@ CMobileTouchManager.prototype = {
this.SendShowMenu(_x, _y);
}
},
};
CheckSelect : function(overlay)
{
CMobileTouchManager.prototype.CheckSelect = function(overlay)
{
if (null == this.RectSelect1 || null == this.RectSelect2)
return;
......@@ -1433,10 +1438,10 @@ CMobileTouchManager.prototype = {
overlay.AddEllipse(pos4.X, pos4.Y + 5, 5);
ctx.fill();
}
},
};
CheckSelect2 : function(overlay)
{
CMobileTouchManager.prototype.CheckSelect2 = function(overlay)
{
if (null == this.RectSelect1 || null == this.RectSelect2)
return;
......@@ -1547,10 +1552,10 @@ CMobileTouchManager.prototype = {
overlay.CheckRect(_x1, _y1, _w, _h);
overlay.CheckRect(_x2, _y2, _w, _h);
}
},
};
CheckTableRules : function(overlay)
{
CMobileTouchManager.prototype.CheckTableRules = function(overlay)
{
if (this.HtmlPage.m_oApi.isViewMode)
return;
......@@ -1794,10 +1799,10 @@ CMobileTouchManager.prototype = {
}
}
}
},
};
CheckTableRules2 : function(overlay)
{
CMobileTouchManager.prototype.CheckTableRules2 = function(overlay)
{
if (this.HtmlPage.m_oApi.isViewMode)
return;
......@@ -2085,5 +2090,8 @@ CMobileTouchManager.prototype = {
}
}
}
}
};
//------------------------------------------------------------export---------------------------------------------------
window['AscCommonExcel'] = window['AscCommonExcel'] || {};
window['AscCommonExcel'].CMobileTouchManager = CMobileTouchManager;
})(window);
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