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:
parent
e9f3761322
commit
4f0c62898c
3 changed files with 17 additions and 1 deletions
|
@ -55,12 +55,17 @@ L.Control.ContextMenu = L.Control.extend({
|
||||||
map.on('locontextmenu', this._onContextMenu, this);
|
map.on('locontextmenu', this._onContextMenu, this);
|
||||||
map.on('mousedown', this._onMouseDown, this);
|
map.on('mousedown', this._onMouseDown, this);
|
||||||
map.on('keydown', this._onKeyDown, this);
|
map.on('keydown', this._onKeyDown, this);
|
||||||
|
map.on('closepopups', this._onClosePopup, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
_onClosePopup: function () {
|
||||||
|
$.contextMenu('destroy', '.leaflet-layer');
|
||||||
},
|
},
|
||||||
|
|
||||||
_onMouseDown: function(e) {
|
_onMouseDown: function(e) {
|
||||||
this._prevMousePos = {x: e.originalEvent.pageX, y: e.originalEvent.pageY};
|
this._prevMousePos = {x: e.originalEvent.pageX, y: e.originalEvent.pageY};
|
||||||
|
|
||||||
$.contextMenu('destroy', '.leaflet-layer');
|
this._onClosePopup();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onKeyDown: function(e) {
|
_onKeyDown: function(e) {
|
||||||
|
|
|
@ -119,6 +119,7 @@ L.Control.LokDialog = L.Control.extend({
|
||||||
map.on('opendialog', this._openDialog, this);
|
map.on('opendialog', this._openDialog, this);
|
||||||
map.on('docloaded', this._docLoaded, this);
|
map.on('docloaded', this._docLoaded, this);
|
||||||
map.on('closepopup', this.onCloseCurrentPopUp, this);
|
map.on('closepopup', this.onCloseCurrentPopUp, this);
|
||||||
|
map.on('closepopups', this._onClosePopups, this);
|
||||||
map.on('editorgotfocus', this._onEditorGotFocus, this);
|
map.on('editorgotfocus', this._onEditorGotFocus, this);
|
||||||
L.DomEvent.on(document, 'mouseup', this.onCloseCurrentPopUp, this);
|
L.DomEvent.on(document, 'mouseup', this.onCloseCurrentPopUp, this);
|
||||||
},
|
},
|
||||||
|
@ -618,6 +619,14 @@ L.Control.LokDialog = L.Control.extend({
|
||||||
removeZoomTarget(this._toStrId(dialogId));
|
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() {
|
onCloseCurrentPopUp: function() {
|
||||||
// for title-less dialog only (context menu, pop-up)
|
// for title-less dialog only (context menu, pop-up)
|
||||||
if (!this._currentId || !this._isOpen(this._currentId) || this._dialogs[this._currentId].title)
|
if (!this._currentId || !this._isOpen(this._currentId) || this._dialogs[this._currentId].title)
|
||||||
|
|
|
@ -201,6 +201,8 @@ L.Map.TouchGesture = L.Handler.extend({
|
||||||
|
|
||||||
if (window.ThisIsTheiOSApp)
|
if (window.ThisIsTheiOSApp)
|
||||||
this._toolbar.remove();
|
this._toolbar.remove();
|
||||||
|
|
||||||
|
this._map.fire('closepopups');
|
||||||
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
|
this._map._contextMenu._onMouseDown({originalEvent: e.srcEvent});
|
||||||
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
|
this._map._docLayer._postMouseEvent('buttondown', mousePos.x, mousePos.y, 1, 1, 0);
|
||||||
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
|
this._map._docLayer._postMouseEvent('buttonup', mousePos.x, mousePos.y, 1, 1, 0);
|
||||||
|
|
Loading…
Reference in a new issue