Commit 7539e1a6 authored by Oleg Korshul's avatar Oleg Korshul

mobile (web): 1) keyboard hide/show, 2) GetNearestPos bug, 3) presentations bugs

parent 959222f1
......@@ -382,6 +382,7 @@ function (window, undefined)
{
var _e = e.touches ? e.touches[0] : e;
this.IsTouching = true;
AscCommon.g_inputContext.enableVirtualKeyboard();
global_mouseEvent.KoefPixToMM = 5;
AscCommon.check_MouseDownEvent(_e, true);
......@@ -427,6 +428,29 @@ function (window, undefined)
break;
}
var isPreventDefault = false;
switch (this.Mode)
{
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.TableMove:
{
isPreventDefault = true;
break;
}
case AscCommon.MobileTouchMode.None:
case AscCommon.MobileTouchMode.Scroll:
{
isPreventDefault = this.CheckObjectTrackBefore();
break;
}
default:
{
break;
}
}
switch (this.Mode)
{
case AscCommon.MobileTouchMode.None:
......@@ -533,14 +557,13 @@ function (window, undefined)
}
}
if (this.Api.isViewMode)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (AscCommon.AscBrowser.isAndroid)
isPreventDefault = false;
if (this.Api.isViewMode || isPreventDefault)
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManager.prototype.onTouchMove = function(e)
{
......@@ -645,6 +668,24 @@ function (window, undefined)
var isCheckContextMenuMode = true;
var isPreventDefault = false;
switch (this.Mode)
{
case AscCommon.MobileTouchMode.Scroll:
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.TableMove:
{
isPreventDefault = true;
break;
}
default:
{
break;
}
}
switch (this.Mode)
{
case AscCommon.MobileTouchMode.Cursor:
......@@ -661,6 +702,10 @@ function (window, undefined)
this.delegate.Drawing_OnMouseDown(_e);
this.delegate.Drawing_OnMouseUp(_e);
this.Api.sendEvent("asc_onTapEvent", e);
var typeMenu = this.delegate.GetContextMenuType();
if (typeMenu == AscCommon.MobileTouchContextMenuType.Target)
isPreventDefault = false;
}
else
{
......@@ -704,17 +749,13 @@ function (window, undefined)
break;
}
if (this.Api.isViewMode)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (this.Api.isViewMode || isPreventDefault)
AscCommon.g_inputContext.preventVirtualKeyboard(e);
if (true !== this.iScroll.isAnimating)
this.CheckContextMenuTouchEnd(isCheckContextMenuMode);
return false;
};
CMobileTouchManager.prototype.mainOnTouchStart = function(e)
......
......@@ -1647,7 +1647,10 @@ IScroll.prototype = {
case 'pointermove':
case 'MSPointerMove':
case 'mousemove':
this.eventsElement ? this.manager.mainOnTouchMove(e) : (e);
if (this.isDown || e.srcElement == this.eventsElement)
{
this.eventsElement ? this.manager.mainOnTouchMove(e) : (e);
}
break;
case 'touchend':
case 'pointerup':
......
......@@ -126,7 +126,7 @@
CMobileDelegateSimple.prototype.SetZoom = function(_value)
{
};
CMobileDelegateSimple.prototype.GetObjectTrack = function(x, y, page)
CMobileDelegateSimple.prototype.GetObjectTrack = function(x, y, page, bSelected)
{
return false;
};
......@@ -820,10 +820,8 @@
CMobileTouchManagerBase.prototype.CheckObjectTrack = function()
{
var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y);
var dKoef = (100 * AscCommon.g_dKoef_pix_to_mm / this.delegate.GetZoom());
global_mouseEvent.KoefPixToMM = 5;
if (this.delegate.GetObjectTrack(pos.X, pos.Y, pos.Page))
if (this.delegate.GetObjectTrack(pos.X, pos.Y, pos.Page, true))
{
this.Mode = AscCommon.MobileTouchMode.FlowObj;
}
......@@ -836,6 +834,15 @@
return (AscCommon.MobileTouchMode.FlowObj == this.Mode);
};
CMobileTouchManagerBase.prototype.CheckObjectTrackBefore = function()
{
var pos = this.delegate.ConvertCoordsFromCursor(global_mouseEvent.X, global_mouseEvent.Y);
global_mouseEvent.KoefPixToMM = 5;
var bResult = this.delegate.GetObjectTrack(pos.X, pos.Y, pos.Page, false);
global_mouseEvent.KoefPixToMM = 1;
return bResult;
};
// в мобильной версии - меньше, чем "по ширине" - не делаем
CMobileTouchManagerBase.prototype.CheckZoomCriticalValues = function(zoomMin)
{
......
......@@ -162,6 +162,9 @@
this.IsInitialInputContext = false;
this.IsDisableKeyPress = false;
this.virtualKeyboardClickTimeout = -1;
this.virtualKeyboardClickPrevent = false;
}
CTextInput.prototype =
......@@ -308,6 +311,33 @@
*/
this.Api.Input_UpdatePos();
if (AscCommon.AscBrowser.isAndroid)
{
this.HtmlArea.onclick = function (e)
{
var _this = AscCommon.g_inputContext;
if (-1 != _this.virtualKeyboardClickTimeout)
{
clearTimeout(_this.virtualKeyboardClickTimeout);
_this.virtualKeyboardClickTimeout = -1;
}
if (!_this.virtualKeyboardClickPrevent)
return;
_this.HtmlArea.readOnly = true;
_this.virtualKeyboardClickPrevent = false;
AscCommon.stopEvent(e);
_this.virtualKeyboardClickTimeout = setTimeout(function ()
{
_this.HtmlArea.readOnly = false;
_this.virtualKeyboardClickTimeout = -1;
}, 1);
return false;
};
}
},
onResize : function(_editorContainerId)
......@@ -1656,6 +1686,30 @@
}, 10);
return true;
},
preventVirtualKeyboard : function(e)
{
//AscCommon.stopEvent(e);
if (AscCommon.AscBrowser.isAndroid)
{
this.virtualKeyboardClickPrevent = true;
}
},
enableVirtualKeyboard : function()
{
if (AscCommon.AscBrowser.isAndroid)
{
if (-1 != this.virtualKeyboardClickTimeout)
{
clearTimeout(this.virtualKeyboardClickTimeout);
this.virtualKeyboardClickTimeout = -1;
}
this.virtualKeyboardClickPrevent = false;
}
}
};
......
......@@ -275,6 +275,7 @@
CMobileTouchManager.prototype.onTouchStart = function(e)
{
this.IsTouching = true;
AscCommon.g_inputContext.enableVirtualKeyboard();
if (this.delegate.IsReader())
return this.onTouchStart_renderer(e);
......@@ -329,6 +330,29 @@
break;
}
var isPreventDefault = false;
switch (this.Mode)
{
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.TableMove:
{
isPreventDefault = true;
break;
}
case AscCommon.MobileTouchMode.None:
case AscCommon.MobileTouchMode.Scroll:
{
isPreventDefault = this.CheckObjectTrackBefore();
break;
}
default:
{
break;
}
}
switch (this.Mode)
{
case AscCommon.MobileTouchMode.None:
......@@ -450,14 +474,13 @@
}
}
if (this.Api.isViewMode)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (AscCommon.AscBrowser.isAndroid)
isPreventDefault = false;
if (this.Api.isViewMode || isPreventDefault)
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManager.prototype.onTouchMove = function(e)
{
......@@ -630,6 +653,24 @@
var isCheckContextMenuMode = true;
var isPreventDefault = false;
switch (this.Mode)
{
case AscCommon.MobileTouchMode.Scroll:
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.TableMove:
{
isPreventDefault = true;
break;
}
default:
{
break;
}
}
switch (this.Mode)
{
case AscCommon.MobileTouchMode.Cursor:
......@@ -646,6 +687,10 @@
this.delegate.Drawing_OnMouseDown(_e);
this.delegate.Drawing_OnMouseUp(_e);
this.Api.sendEvent("asc_onTapEvent", e);
var typeMenu = this.delegate.GetContextMenuType();
if (typeMenu == AscCommon.MobileTouchContextMenuType.Target)
isPreventDefault = false;
}
else
{
......@@ -794,17 +839,13 @@
break;
}
if (this.Api.isViewMode)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (this.Api.isViewMode || isPreventDefault)
AscCommon.g_inputContext.preventVirtualKeyboard(e);
if (true !== this.iScroll.isAnimating)
this.CheckContextMenuTouchEnd(isCheckContextMenuMode);
return false;
};
CMobileTouchManager.prototype.mainOnTouchStart = function(e)
......@@ -812,7 +853,7 @@
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!this.Api.IsFocus)
if (!this.Api.asc_IsFocus())
this.Api.asc_enableKeyEvents(true);
var oWordControl = this.Api.WordControl;
......
......@@ -81,6 +81,7 @@
CMobileTouchManager.prototype.onTouchStart = function(e)
{
this.IsTouching = true;
AscCommon.g_inputContext.enableVirtualKeyboard();
if (this.delegate.IsReader())
return this.onTouchStart_renderer(e);
......@@ -135,6 +136,29 @@
break;
}
var isPreventDefault = false;
switch (this.Mode)
{
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.TableMove:
{
isPreventDefault = true;
break;
}
case AscCommon.MobileTouchMode.None:
case AscCommon.MobileTouchMode.Scroll:
{
isPreventDefault = this.CheckObjectTrackBefore();
break;
}
default:
{
break;
}
}
switch (this.Mode)
{
case AscCommon.MobileTouchMode.None:
......@@ -256,14 +280,13 @@
}
}
if (this.Api.isViewMode)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (AscCommon.AscBrowser.isAndroid)
isPreventDefault = false;
if (this.Api.isViewMode || isPreventDefault)
AscCommon.stopEvent(e);
return false;
};
CMobileTouchManager.prototype.onTouchMove = function(e)
{
......@@ -436,6 +459,24 @@
var isCheckContextMenuMode = true;
var isPreventDefault = false;
switch (this.Mode)
{
case AscCommon.MobileTouchMode.Scroll:
case AscCommon.MobileTouchMode.InlineObj:
case AscCommon.MobileTouchMode.FlowObj:
case AscCommon.MobileTouchMode.Zoom:
case AscCommon.MobileTouchMode.TableMove:
{
isPreventDefault = true;
break;
}
default:
{
break;
}
}
switch (this.Mode)
{
case AscCommon.MobileTouchMode.Cursor:
......@@ -452,6 +493,10 @@
this.delegate.Drawing_OnMouseDown(_e);
this.delegate.Drawing_OnMouseUp(_e);
this.Api.sendEvent("asc_onTapEvent", e);
var typeMenu = this.delegate.GetContextMenuType();
if (typeMenu == AscCommon.MobileTouchContextMenuType.Target)
isPreventDefault = false;
}
else
{
......@@ -600,17 +645,13 @@
break;
}
if (this.Api.isViewMode)
{
if (e.preventDefault)
e.preventDefault();
else
e.returnValue = false;
return false;
}
if (this.Api.isViewMode || isPreventDefault)
AscCommon.g_inputContext.preventVirtualKeyboard(e);
if (true !== this.iScroll.isAnimating)
this.CheckContextMenuTouchEnd(isCheckContextMenuMode);
return false;
};
CMobileTouchManager.prototype.mainOnTouchStart = function(e)
......@@ -618,7 +659,7 @@
if (AscCommon.g_inputContext && AscCommon.g_inputContext.externalChangeFocus())
return;
if (!this.Api.IsFocus)
if (!this.Api.asc_IsFocus())
this.Api.asc_enableKeyEvents(true);
var oWordControl = this.Api.WordControl;
......
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