[Libreoffice-commits] online.git: loleaflet/src
Andras Timar
andras.timar at collabora.com
Fri Jun 10 21:49:31 UTC 2016
loleaflet/src/control/Control.ContextMenu.js | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit 445f97a0c78210c0086009a88cb6a0a60012c944
Author: Andras Timar <andras.timar at collabora.com>
Date: Fri Jun 10 23:42:11 2016 +0200
loleaflet: hide context menu after pressing ESC key
diff --git a/loleaflet/src/control/Control.ContextMenu.js b/loleaflet/src/control/Control.ContextMenu.js
index 1ed047e..dd84c70 100644
--- a/loleaflet/src/control/Control.ContextMenu.js
+++ b/loleaflet/src/control/Control.ContextMenu.js
@@ -44,6 +44,7 @@ L.Control.ContextMenu = L.Control.extend({
map.on('locontextmenu', this._onContextMenu, this);
map.on('mousedown', this._onMouseDown, this);
+ map.on('keydown', this._onKeyDown, this);
},
_onMouseDown: function(e) {
@@ -52,6 +53,12 @@ L.Control.ContextMenu = L.Control.extend({
$.contextMenu('destroy', '.leaflet-layer');
},
+ _onKeyDown: function(e) {
+ if (e.originalEvent.keyCode === 27 /* ESC */) {
+ $.contextMenu('destroy', '.leaflet-layer');
+ }
+ },
+
_onContextMenu: function(obj) {
if (!map._editlock) {
return;
More information about the Libreoffice-commits
mailing list