[Libreoffice-commits] online.git: loleaflet/src
Henry Castro
hcastro at collabora.com
Mon Jun 15 19:14:33 PDT 2015
loleaflet/src/layer/tile/TileLayer.js | 4 +++-
loleaflet/src/map/Map.js | 1 +
loleaflet/src/map/handler/Map.Keyboard.js | 2 +-
3 files changed, 5 insertions(+), 2 deletions(-)
New commits:
commit ac58e56de2c0879509bbfaabe182c9c99e658ef3
Author: Henry Castro <hcastro at collabora.com>
Date: Mon Jun 15 22:06:33 2015 -0400
loleaflet: Disable Map keys when editing documents.
When the document is in editing mode, the default map
keys for zooming is disabled.
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index b22ba9f..c8957d5 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -749,7 +749,7 @@ L.TileLayer = L.GridLayer.extend({
this._keyEvent = e.originalEvent;
this._postKeyboardEvent('input', this._keyEvent.charCode, this._toUNOKeyCode(this._keyEvent.keyCode));
}
- else if ( e.type === 'keyup' ) {
+ else if ( e.type === 'keyup' && this._keyEvent ) {
this._postKeyboardEvent('up', this._keyEvent.charCode, this._toUNOKeyCode(this._keyEvent.keyCode));
}
},
@@ -770,11 +770,13 @@ L.TileLayer = L.GridLayer.extend({
var latBounds = L.rectangle(this._aVisibleCursor).getLatLngs();
this._cursorMarker = L.cursor(latBounds[2], {color: 'red'});
+ this._map._bDisableKeyboard = true;
this._map.addLayer(this._cursorMarker);
this._cursorMarker.setSize(pixBounds.getSize());
}
else {
if (this._cursorMarker) {
+ this._map._bDisableKeyboard = false;
this._map.removeLayer(this._cursorMarker);
this._bCursorOverlayVisible = false;
}
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 06b31b4..7aa600a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -49,6 +49,7 @@ L.Map = L.Evented.extend({
this._layers = {};
this._zoomBoundLayers = {};
this._sizeChanged = true;
+ this._bDisableKeyboard = false;
this.callInitHooks();
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index ec5c72f..e524ce8 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -125,7 +125,7 @@ L.Map.Keyboard = L.Handler.extend({
},
_onKeyDown: function (e) {
- if (e.altKey || e.ctrlKey || e.metaKey) { return; }
+ if (this._map._bDisableKeyboard || e.altKey || e.ctrlKey || e.metaKey) { return; }
var key = e.keyCode,
map = this._map;
More information about the Libreoffice-commits
mailing list