loeaflet: mobile: close popup dialog on tap event

Change-Id: Iad64295db4d9d135b4ce1f68bb62948e7be8e92e
Reviewed-on: https://gerrit.libreoffice.org/77831
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
This commit is contained in:
Henry Castro 2019-06-17 14:30:08 -04:00
parent e9f3761322
commit 4f0c62898c
3 changed files with 17 additions and 1 deletions

View file

@ -55,12 +55,17 @@ L.Control.ContextMenu = L.Control.extend({
map.on('locontextmenu', this._onContextMenu, this);
map.on('mousedown', this._onMouseDown, this);
map.on('keydown', this._onKeyDown, this);
map.on('closepopups', this._onClosePopup, this);
},
_onClosePopup: function () {
$.contextMenu('destroy', '.leaflet-layer');
},
_onMouseDown: function(e) {
this._prevMousePos = {x: e.originalEvent.pageX, y: e.originalEvent.pageY};
$.contextMenu('destroy', '.leaflet-layer');
this._onClosePopup();
},
_onKeyDown: function(e) {

View file

@ -119,6 +119,7 @@ L.Control.LokDialog = L.Control.extend({
map.on('opendialog', this._openDialog, this);
map.on('docloaded', this._docLoaded, this);
map.on('closepopup', this.onCloseCurrentPopUp, this);
map.on('closepopups', this._onClosePopups, this);
map.on('editorgotfocus', this._onEditorGotFocus, this);
L.DomEvent.on(document, 'mouseup', this.onCloseCurrentPopUp, this);
},
@ -618,6 +619,14 @@ L.Control.LokDialog = L.Control.extend({
removeZoomTarget(this._toStrId(dialogId));
},
_onClosePopups: function() {
for (var dialog in this._dialogs) {
if (this._dialogs[dialog].isSidebar != true) {
this._onDialogClose(this._dialogs[dialog].id, true);
}
}
},
onCloseCurrentPopUp: function() {
// for title-less dialog only (context menu, pop-up)
if (!this._currentId || !this._isOpen(this._currentId) || this._dialogs[this._currentId].title)

View file

@ -201,6 +201,8 @@ L.Map.TouchGesture = L.Handler.extend({
if (window.ThisIsTheiOSApp)
this._toolbar.remove();
this._map.fire('closepopups');
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);