Commit 25d75e31 authored by Oleg Korshul's avatar Oleg Korshul

memory optimize & mobile presentations

parent 08b86c90
...@@ -365,6 +365,8 @@ ...@@ -365,6 +365,8 @@
global_mouseEvent.Type = g_mouse_event_type_down; global_mouseEvent.Type = g_mouse_event_type_down;
global_mouseEvent.Button = (e.button !== undefined) ? e.button : 0; global_mouseEvent.Button = (e.button !== undefined) ? e.button : 0;
if (global_mouseEvent.Button == -1)
global_mouseEvent.Button = 0;
global_mouseEvent.Sender = (e.srcElement) ? e.srcElement : e.target; global_mouseEvent.Sender = (e.srcElement) ? e.srcElement : e.target;
......
...@@ -1114,7 +1114,7 @@ function tt_face_load_hmtx(face, stream, isvertical) ...@@ -1114,7 +1114,7 @@ function tt_face_load_hmtx(face, stream, isvertical)
num_shorts_checked = parseInt((table_len - num_longs * 4) / 2); num_shorts_checked = parseInt((table_len - num_longs * 4) / 2);
if (num_longs > 0) if (num_longs > 0)
lm.long_metrics = new Array(num_longs); lm.long_metrics = new CreateIntArray(num_longs * 2);
if (num_shorts > 0) if (num_shorts > 0)
lm.short_metrics = new Array(num_shorts); lm.short_metrics = new Array(num_shorts);
...@@ -1128,9 +1128,8 @@ function tt_face_load_hmtx(face, stream, isvertical) ...@@ -1128,9 +1128,8 @@ function tt_face_load_hmtx(face, stream, isvertical)
for (var i = 0; i < num_longs; i++) for (var i = 0; i < num_longs; i++)
{ {
longs[i] = new TT_LongMetricsRec(); longs[_cur++] = stream.GetUShort();
longs[i].advance = stream.GetUShort(); longs[_cur++] = stream.GetShort();
longs[i].bearing = stream.GetShort();
} }
var count_s = Math.min(num_shorts, num_shorts_checked); var count_s = Math.min(num_shorts, num_shorts_checked);
...@@ -1251,17 +1250,17 @@ function tt_face_get_metrics(face, vertical, gindex) ...@@ -1251,17 +1250,17 @@ function tt_face_get_metrics(face, vertical, gindex)
if (k == 0 || null == header.long_metrics || gindex >= face.max_profile.numGlyphs) if (k == 0 || null == header.long_metrics || gindex >= face.max_profile.numGlyphs)
return { bearing:0,advance:0 }; return { bearing:0,advance:0 };
if (gindex < k) if (gindex < k)
{ {
longs_m = header.long_metrics[gindex]; var _ind = gindex << 1;
v1 = longs_m.bearing; v1 = header.long_metrics[_ind + 1];
v2 = longs_m.advance; v2 = header.long_metrics[_ind];
} }
else else
{ {
v1 = header.short_metrics[gindex - k]; v1 = header.short_metrics[gindex - k];
v2 = header.long_metrics[k - 1].advance; v2 = header.long_metrics[(k - 1) << 1];
} }
return { bearing:v1,advance:v2 }; return { bearing:v1,advance:v2 };
} }
/******************************************************************************/ /******************************************************************************/
......
...@@ -13744,7 +13744,7 @@ function tt_face_load_hmtx(face, stream, isvertical) ...@@ -13744,7 +13744,7 @@ function tt_face_load_hmtx(face, stream, isvertical)
num_shorts_checked = parseInt((table_len - num_longs * 4) / 2); num_shorts_checked = parseInt((table_len - num_longs * 4) / 2);
if (num_longs > 0) if (num_longs > 0)
lm.long_metrics = new Array(num_longs); lm.long_metrics = new CreateIntArray(num_longs * 2);
if (num_shorts > 0) if (num_shorts > 0)
lm.short_metrics = new Array(num_shorts); lm.short_metrics = new Array(num_shorts);
...@@ -13756,11 +13756,11 @@ function tt_face_load_hmtx(face, stream, isvertical) ...@@ -13756,11 +13756,11 @@ function tt_face_load_hmtx(face, stream, isvertical)
error = stream.EnterFrame(table_len); error = stream.EnterFrame(table_len);
var _cur = 0;
for (var i = 0; i < num_longs; i++) for (var i = 0; i < num_longs; i++)
{ {
longs[i] = new TT_LongMetricsRec(); longs[_cur++] = stream.GetUShort();
longs[i].advance = stream.GetUShort(); longs[_cur++] = stream.GetShort();
longs[i].bearing = stream.GetShort();
} }
var count_s = Math.min(num_shorts, num_shorts_checked); var count_s = Math.min(num_shorts, num_shorts_checked);
...@@ -13883,14 +13883,14 @@ function tt_face_get_metrics(face, vertical, gindex) ...@@ -13883,14 +13883,14 @@ function tt_face_get_metrics(face, vertical, gindex)
if (gindex < k) if (gindex < k)
{ {
longs_m = header.long_metrics[gindex]; var _ind = gindex << 1;
v1 = longs_m.bearing; v1 = header.long_metrics[_ind + 1];
v2 = longs_m.advance; v2 = header.long_metrics[_ind];
} }
else else
{ {
v1 = header.short_metrics[gindex - k]; v1 = header.short_metrics[gindex - k];
v2 = header.long_metrics[k - 1].advance; v2 = header.long_metrics[(k - 1) << 1];
} }
return { bearing:v1,advance:v2 }; return { bearing:v1,advance:v2 };
} }
...@@ -284,6 +284,7 @@ function IScroll (el, options) { ...@@ -284,6 +284,7 @@ function IScroll (el, options) {
this.wrapper = typeof el == 'string' ? document.querySelector(el) : el; this.wrapper = typeof el == 'string' ? document.querySelector(el) : el;
this.scroller = (typeof options.scroller_id == 'string') ? document.getElementById(options.scroller_id) : this.wrapper.children[0]; this.scroller = (typeof options.scroller_id == 'string') ? document.getElementById(options.scroller_id) : this.wrapper.children[0];
this.scrollerStyle = this.scroller.style; // cache style for better performance this.scrollerStyle = this.scroller.style; // cache style for better performance
this.eventsElement = options.eventsElement;
this.options = { this.options = {
...@@ -936,32 +937,46 @@ IScroll.prototype = { ...@@ -936,32 +937,46 @@ IScroll.prototype = {
}, },
_initEvents: function (remove) { _initEvents: function (remove) {
if (typeof this.eventsElement == "string")
{
var _element = document.getElementById(this.eventsElement);
if (!_element)
return;
this.eventsElement = _element;
}
var eventType = remove ? utils.removeEvent : utils.addEvent, var eventType = remove ? utils.removeEvent : utils.addEvent,
target = this.options.bindToWrapper ? this.wrapper : window; target = this.options.bindToWrapper ? (this.eventsElement ? this.eventsElement : this.wrapper) : window;
eventType(window, 'orientationchange', this); var _wrapper = this.eventsElement ? this.eventsElement : this.wrapper;
eventType(window, 'resize', this);
if (this.options.resizeDetect)
{
eventType(window, 'orientationchange', this);
eventType(window, 'resize', this);
}
if ( this.options.click ) { if ( this.options.click ) {
eventType(this.wrapper, 'click', this, true); eventType(_wrapper, 'click', this, true);
} }
if ( !this.options.disableMouse ) { if ( !this.options.disableMouse ) {
eventType(this.wrapper, 'mousedown', this); eventType(_wrapper, 'mousedown', this);
eventType(target, 'mousemove', this); eventType(target, 'mousemove', this);
eventType(target, 'mousecancel', this); eventType(target, 'mousecancel', this);
eventType(target, 'mouseup', this); eventType(target, 'mouseup', this);
} }
if ( utils.hasPointer && !this.options.disablePointer ) { if ( utils.hasPointer && !this.options.disablePointer ) {
eventType(this.wrapper, utils.prefixPointerEvent('pointerdown'), this); eventType(_wrapper, utils.prefixPointerEvent('pointerdown'), this);
eventType(target, utils.prefixPointerEvent('pointermove'), this); eventType(target, utils.prefixPointerEvent('pointermove'), this);
eventType(target, utils.prefixPointerEvent('pointercancel'), this); eventType(target, utils.prefixPointerEvent('pointercancel'), this);
eventType(target, utils.prefixPointerEvent('pointerup'), this); eventType(target, utils.prefixPointerEvent('pointerup'), this);
} }
if ( utils.hasTouch && !this.options.disableTouch ) { if ( utils.hasTouch && !this.options.disableTouch ) {
eventType(this.wrapper, 'touchstart', this); eventType(_wrapper, 'touchstart', this);
eventType(target, 'touchmove', this); eventType(target, 'touchmove', this);
eventType(target, 'touchcancel', this); eventType(target, 'touchcancel', this);
eventType(target, 'touchend', this); eventType(target, 'touchend', this);
...@@ -1622,13 +1637,13 @@ IScroll.prototype = { ...@@ -1622,13 +1637,13 @@ IScroll.prototype = {
case 'pointerdown': case 'pointerdown':
case 'MSPointerDown': case 'MSPointerDown':
case 'mousedown': case 'mousedown':
this._start(e); this.eventsElement ? this.manager.mainOnTouchStart(e) : this._start(e);
break; break;
case 'touchmove': case 'touchmove':
case 'pointermove': case 'pointermove':
case 'MSPointerMove': case 'MSPointerMove':
case 'mousemove': case 'mousemove':
this._move(e); this.eventsElement ? this.manager.mainOnTouchMove(e) : (e);
break; break;
case 'touchend': case 'touchend':
case 'pointerup': case 'pointerup':
...@@ -1638,7 +1653,7 @@ IScroll.prototype = { ...@@ -1638,7 +1653,7 @@ IScroll.prototype = {
case 'pointercancel': case 'pointercancel':
case 'MSPointerCancel': case 'MSPointerCancel':
case 'mousecancel': case 'mousecancel':
this._end(e); this.eventsElement ? this.manager.mainOnTouchEnd(e) : this._end(e);
break; break;
case 'orientationchange': case 'orientationchange':
case 'resize': case 'resize':
......
...@@ -98,7 +98,7 @@ ...@@ -98,7 +98,7 @@
{ {
return null; return null;
}; };
CMobileDelegateSimple.prototype.ConvertCoordsToCursor = function(x, y, page) CMobileDelegateSimple.prototype.ConvertCoordsToCursor = function(x, y, page, isCanvas /* делать ли сдвиги на сам редактор */)
{ {
return null; return null;
}; };
...@@ -418,7 +418,7 @@ ...@@ -418,7 +418,7 @@
return this.HtmlPage.onMouseUp(e); return this.HtmlPage.onMouseUp(e);
}; };
function CMobileTouchManagerBase(_config, _delegate) function CMobileTouchManagerBase(_config)
{ {
this.Api = null; this.Api = null;
this.Mode = AscCommon.MobileTouchMode.None; this.Mode = AscCommon.MobileTouchMode.None;
...@@ -477,8 +477,18 @@ ...@@ -477,8 +477,18 @@
/* delegate */ /* delegate */
this.delegate = null; this.delegate = null;
/* eventsElement */
this.eventsElement = _config.eventsElement;
} }
CMobileTouchManagerBase.prototype.initEvents = function(_id)
{
this.eventsElement = _id;
this.iScroll.eventsElement = this.eventsElement;
this.iScroll._initEvents();
};
// создание вспомогательного элемента, для прокрутки. по идее потом можно изменить // создание вспомогательного элемента, для прокрутки. по идее потом можно изменить
// просто на сдвиги. но пока так // просто на сдвиги. но пока так
CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper) CMobileTouchManagerBase.prototype.CreateScrollerDiv = function(_wrapper)
...@@ -1560,6 +1570,38 @@ ...@@ -1560,6 +1570,38 @@
global_mouseEvent.ClickCount = old_click_count; global_mouseEvent.ClickCount = old_click_count;
}; };
CMobileTouchManagerBase.prototype.onTouchStart = function(e)
{
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManagerBase.prototype.onTouchMove = function(e)
{
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManagerBase.prototype.onTouchEnd = function(e)
{
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManagerBase.prototype.mainOnTouchStart = function(e)
{
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManagerBase.prototype.mainOnTouchMove = function(e)
{
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManagerBase.prototype.mainOnTouchEnd = function(e)
{
AscCommon.stopEvent(e);
return false;
};
//--------------------------------------------------------export---------------------------------------------------- //--------------------------------------------------------export----------------------------------------------------
AscCommon.CMobileDelegateSimple = CMobileDelegateSimple; AscCommon.CMobileDelegateSimple = CMobileDelegateSimple;
AscCommon.CMobileTouchManagerBase = CMobileTouchManagerBase; AscCommon.CMobileTouchManagerBase = CMobileTouchManagerBase;
......
...@@ -708,6 +708,8 @@ function CDrawingDocument() ...@@ -708,6 +708,8 @@ function CDrawingDocument()
this.TargetShowFlag = false; this.TargetShowFlag = false;
this.TargetShowNeedFlag = false; this.TargetShowNeedFlag = false;
this.SelectionMatrix = null;
this.CanvasHit = document.createElement('canvas'); this.CanvasHit = document.createElement('canvas');
this.CanvasHit.width = 10; this.CanvasHit.width = 10;
this.CanvasHit.height = 10; this.CanvasHit.height = 10;
...@@ -1850,6 +1852,9 @@ function CDrawingDocument() ...@@ -1850,6 +1852,9 @@ function CDrawingDocument()
} }
this.AddPageSelection = function(pageIndex, x, y, width, height) this.AddPageSelection = function(pageIndex, x, y, width, height)
{ {
if (null == this.SelectionMatrix)
this.SelectionMatrix = this.TextMatrix;
if (pageIndex < 0 || pageIndex != this.SlideCurrent || Math.abs(width) < 0.001 || Math.abs(height) < 0.001) if (pageIndex < 0 || pageIndex != this.SlideCurrent || Math.abs(width) < 0.001 || Math.abs(height) < 0.001)
return; return;
......
...@@ -547,10 +547,10 @@ function CEditorPage(api) ...@@ -547,10 +547,10 @@ function CEditorPage(api)
if (this.m_oApi.isMobileVersion) if (this.m_oApi.isMobileVersion)
{ {
this.MobileTouchManager = new AscCommon.CMobileTouchManager(); this.MobileTouchManager = new AscCommon.CMobileTouchManager( { eventsElement : "slides_mobile_element" } );
this.MobileTouchManager.Init(this.m_oApi); this.MobileTouchManager.Init(this.m_oApi);
this.MobileTouchManagerThumbnails = new AscCommon.CMobileTouchManagerThumbnails(); this.MobileTouchManagerThumbnails = new AscCommon.CMobileTouchManagerThumbnails( { eventsElement : "slides_mobile_element" } );
this.MobileTouchManagerThumbnails.Init(this.m_oApi); this.MobileTouchManagerThumbnails.Init(this.m_oApi);
} }
...@@ -767,167 +767,8 @@ function CEditorPage(api) ...@@ -767,167 +767,8 @@ function CEditorPage(api)
this.TextBoxBackground = CreateControl(AscCommon.g_inputContext.HtmlArea.id); this.TextBoxBackground = CreateControl(AscCommon.g_inputContext.HtmlArea.id);
this.TextBoxBackground.HtmlElement.parentNode.parentNode.style.zIndex = 10; this.TextBoxBackground.HtmlElement.parentNode.parentNode.style.zIndex = 10;
var __hasTouch = 'ontouchstart' in window; this.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);
this.MobileTouchManagerThumbnails.initEvents(this.m_oThumbnails.HtmlElement.id);
if (__hasTouch)
{
this.TextBoxBackground.HtmlElement["ontouchcancel"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchEnd(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["ontouchstart"] = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!oThis.IsFocus)
oThis.m_oApi.asc_enableKeyEvents(true);
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchStart(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["ontouchmove"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchMove(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["ontouchend"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchEnd(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
//
this.m_oThumbnails.HtmlElement["ontouchstart"] = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchStart(e);
};
this.m_oThumbnails.HtmlElement["ontouchmove"] = function(e)
{
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchMove(e);
};
this.m_oThumbnails.HtmlElement["ontouchend"] = function(e)
{
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchEnd(e);
};
this.m_oThumbnails.HtmlElement["ontouchcancel"] = function(e)
{
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchEnd(e);
};
}
else
{
this.TextBoxBackground.HtmlElement["onmousedown"] = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchStart(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["onmousemove"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchMove(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["onmouseup"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchEnd(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
//
this.m_oThumbnails.HtmlElement["onmousedown"] = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchStart(e);
};
this.m_oThumbnails.HtmlElement["onmousemove"] = function(e)
{
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchMove(e);
};
this.m_oThumbnails.HtmlElement["onmouseup"] = function(e)
{
if (!oThis.MobileTouchManagerThumbnails)
return false;
return oThis.MobileTouchManagerThumbnails.onTouchEnd(e);
};
}
if (AscCommon.AscBrowser.isAndroid) if (AscCommon.AscBrowser.isAndroid)
{ {
...@@ -2794,6 +2635,7 @@ function CEditorPage(api) ...@@ -2794,6 +2635,7 @@ function CEditorPage(api)
var ctx = overlay.m_oContext; var ctx = overlay.m_oContext;
var drDoc = this.m_oDrawingDocument; var drDoc = this.m_oDrawingDocument;
drDoc.SelectionMatrix = null;
if (drDoc.SlideCurrent >= drDoc.m_oLogicDocument.Slides.length) if (drDoc.SlideCurrent >= drDoc.m_oLogicDocument.Slides.length)
drDoc.SlideCurrent = drDoc.m_oLogicDocument.Slides.length - 1; drDoc.SlideCurrent = drDoc.m_oLogicDocument.Slides.length - 1;
......
...@@ -52,6 +52,10 @@ ...@@ -52,6 +52,10 @@
CMobileDelegateEditorPresentation.prototype.ConvertCoordsToCursor = function(x, y, page, isGlobal) CMobileDelegateEditorPresentation.prototype.ConvertCoordsToCursor = function(x, y, page, isGlobal)
{ {
return this.DrawingDocument.ConvertCoordsToCursor(x, y); return this.DrawingDocument.ConvertCoordsToCursor(x, y);
if (isGlobal)
return this.DrawingDocument.ConvertCoordsToCursor(x, y);
else
return this.DrawingDocument.ConvertCoordsToCursorWR(x, y);
}; };
CMobileDelegateEditorPresentation.prototype.ConvertCoordsFromCursor = function(x, y) CMobileDelegateEditorPresentation.prototype.ConvertCoordsFromCursor = function(x, y)
{ {
...@@ -228,7 +232,9 @@ ...@@ -228,7 +232,9 @@
fadeScrollbars: true, fadeScrollbars: true,
scrollX : true, scrollX : true,
scroller_id : this.iScrollElement, scroller_id : this.iScrollElement,
bounce : false bounce : false,
eventsElement : this.eventsElement,
click : false
}); });
this.delegate.Init(); this.delegate.Init();
...@@ -772,6 +778,43 @@ ...@@ -772,6 +778,43 @@
this.CheckContextMenuTouchEnd(isCheckContextMenuMode); this.CheckContextMenuTouchEnd(isCheckContextMenuMode);
}; };
CMobileTouchManager.prototype.mainOnTouchStart = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!this.Api.IsFocus)
this.Api.asc_enableKeyEvents(true);
var oWordControl = this.Api.WordControl;
oWordControl.IsUpdateOverlayOnlyEndReturn = true;
oWordControl.StartUpdateOverlay();
var ret = this.onTouchStart(e);
oWordControl.IsUpdateOverlayOnlyEndReturn = false;
oWordControl.EndUpdateOverlay();
return ret;
};
CMobileTouchManager.prototype.mainOnTouchMove = function(e)
{
var oWordControl = this.Api.WordControl;
oWordControl.IsUpdateOverlayOnlyEndReturn = true;
oWordControl.StartUpdateOverlay();
var ret = this.onTouchMove(e);
oWordControl.IsUpdateOverlayOnlyEndReturn = false;
oWordControl.EndUpdateOverlay();
return ret;
};
CMobileTouchManager.prototype.mainOnTouchEnd = function(e)
{
var oWordControl = this.Api.WordControl;
oWordControl.IsUpdateOverlayOnlyEndReturn = true;
oWordControl.StartUpdateOverlay();
var ret = this.onTouchEnd(e);
oWordControl.IsUpdateOverlayOnlyEndReturn = false;
oWordControl.EndUpdateOverlay();
return ret;
};
/**************************************************************************/ /**************************************************************************/
/** /**
...@@ -975,6 +1018,22 @@ ...@@ -975,6 +1018,22 @@
return false; return false;
}; };
CMobileTouchManagerThumbnails.prototype.mainOnTouchStart = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
return this.onTouchStart(e);
};
CMobileTouchManagerThumbnails.prototype.mainOnTouchMove = function(e)
{
return this.onTouchMove(e);
};
CMobileTouchManagerThumbnails.prototype.mainOnTouchEnd = function(e)
{
return this.onTouchEnd(e);
};
//--------------------------------------------------------export---------------------------------------------------- //--------------------------------------------------------export----------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {}; window['AscCommon'] = window['AscCommon'] || {};
window['AscCommon'].CMobileTouchManager = CMobileTouchManager; window['AscCommon'].CMobileTouchManager = CMobileTouchManager;
......
...@@ -444,7 +444,7 @@ function CEditorPage(api) ...@@ -444,7 +444,7 @@ function CEditorPage(api)
if (this.m_oApi.isMobileVersion) if (this.m_oApi.isMobileVersion)
{ {
this.MobileTouchManager = new AscCommon.CMobileTouchManager(); this.MobileTouchManager = new AscCommon.CMobileTouchManager( { eventsElement : "word_mobile_element" } );
this.MobileTouchManager.Init(this.m_oApi); this.MobileTouchManager.Init(this.m_oApi);
} }
...@@ -792,108 +792,7 @@ function CEditorPage(api) ...@@ -792,108 +792,7 @@ function CEditorPage(api)
this.TextBoxBackground = CreateControl(AscCommon.g_inputContext.HtmlArea.id); this.TextBoxBackground = CreateControl(AscCommon.g_inputContext.HtmlArea.id);
this.TextBoxBackground.HtmlElement.parentNode.parentNode.style.zIndex = 10; this.TextBoxBackground.HtmlElement.parentNode.parentNode.style.zIndex = 10;
var __hasTouch = 'ontouchstart' in window; this.MobileTouchManager.initEvents(AscCommon.g_inputContext.HtmlArea.id);
if (__hasTouch)
{
this.TextBoxBackground.HtmlElement["ontouchcancel"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchEnd(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["ontouchstart"] = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!oThis.IsFocus)
oThis.m_oApi.asc_enableKeyEvents(true);
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchStart(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["ontouchmove"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchMove(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["ontouchend"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchEnd(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
}
else
{
this.TextBoxBackground.HtmlElement["onmousedown"] = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchStart(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["onmousemove"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchMove(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
this.TextBoxBackground.HtmlElement["onmouseup"] = function(e)
{
if (!oThis.MobileTouchManager)
return false;
oThis.IsUpdateOverlayOnlyEndReturn = true;
oThis.StartUpdateOverlay();
var ret = oThis.MobileTouchManager.onTouchEnd(e);
oThis.IsUpdateOverlayOnlyEndReturn = false;
oThis.EndUpdateOverlay();
return ret;
};
}
if (AscBrowser.isAndroid) if (AscBrowser.isAndroid)
{ {
......
...@@ -66,7 +66,9 @@ ...@@ -66,7 +66,9 @@
fadeScrollbars: true, fadeScrollbars: true,
scrollX : true, scrollX : true,
scroller_id : this.iScrollElement, scroller_id : this.iScrollElement,
bounce : false bounce : false,
eventsElement : this.eventsElement,
click : false
}); });
this.delegate.Init(); this.delegate.Init();
...@@ -610,6 +612,44 @@ ...@@ -610,6 +612,44 @@
this.CheckContextMenuTouchEnd(isCheckContextMenuMode); this.CheckContextMenuTouchEnd(isCheckContextMenuMode);
}; };
CMobileTouchManager.prototype.mainOnTouchStart = function(e)
{
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!this.Api.IsFocus)
this.Api.asc_enableKeyEvents(true);
var oWordControl = this.Api.WordControl;
oWordControl.IsUpdateOverlayOnlyEndReturn = true;
oWordControl.StartUpdateOverlay();
var ret = this.onTouchStart(e);
oWordControl.IsUpdateOverlayOnlyEndReturn = false;
oWordControl.EndUpdateOverlay();
return ret;
};
CMobileTouchManager.prototype.mainOnTouchMove = function(e)
{
var oWordControl = this.Api.WordControl;
oWordControl.IsUpdateOverlayOnlyEndReturn = true;
oWordControl.StartUpdateOverlay();
var ret = this.onTouchMove(e);
oWordControl.IsUpdateOverlayOnlyEndReturn = false;
oWordControl.EndUpdateOverlay();
return ret;
};
CMobileTouchManager.prototype.mainOnTouchEnd = function(e)
{
var oWordControl = this.Api.WordControl;
oWordControl.IsUpdateOverlayOnlyEndReturn = true;
oWordControl.StartUpdateOverlay();
var ret = this.onTouchEnd(e);
oWordControl.IsUpdateOverlayOnlyEndReturn = false;
oWordControl.EndUpdateOverlay();
return ret;
};
/*************************************** READER ******************************************/ /*************************************** READER ******************************************/
/** /**
* @extends {AscCommon.CMobileDelegateSimple} * @extends {AscCommon.CMobileDelegateSimple}
......
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