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