[Libreoffice-commits] online.git: loleaflet/src

Henry Castro hcastro at collabora.com
Fri Jun 19 06:51:40 PDT 2015


 loleaflet/src/layer/tile/TileLayer.js |    6 +++++-
 loleaflet/src/map/Map.js              |    4 ++--
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit c157e732f935eddd39c605fb99d81f7279635b95
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri Jun 19 09:50:24 2015 -0400

    loleaflet: Add keydown event.

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index f940324..6882bd6 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -182,6 +182,7 @@ L.TileLayer = L.GridLayer.extend({
 		var events = {
 			viewreset: this._viewReset,
 			moveend: this._move,
+			keydown: this._signalKey,
 			keypress: this._signalKey,
 			keyup: this._signalKey
 		};
@@ -746,7 +747,10 @@ L.TileLayer = L.GridLayer.extend({
 		if ( !this._bEdit )
 			return;
 
-		if ( e.type === 'keypress' ) {
+		if ( e.type == 'keydown' ) {
+			this._keyEvent = null;
+		}
+		else if ( e.type === 'keypress' ) {
 			this._keyEvent = e.originalEvent;
 			this._postKeyboardEvent('input', this._keyEvent.charCode, this._toUNOKeyCode(this._keyEvent.keyCode));
 		}
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 7aa600a..dcb3b2a 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -583,7 +583,7 @@ L.Map = L.Evented.extend({
 		var onOff = remove ? 'off' : 'on';
 
 		L.DomEvent[onOff](this._container, 'click dblclick mousedown mouseup ' +
-			'mouseover mouseout mousemove contextmenu keypress keyup', this._handleDOMEvent, this);
+			'mouseover mouseout mousemove contextmenu keydown keypress keyup', this._handleDOMEvent, this);
 
 		if (this.options.trackResize) {
 			L.DomEvent[onOff](window, 'resize', this._onResize, this);
@@ -636,7 +636,7 @@ L.Map = L.Evented.extend({
 		var data = {
 			originalEvent: e
 		};
-		if (e.type !== 'keypress' && e.type !== 'keyup') {
+		if (e.type !== 'keypress' && e.type !== 'keyup' && e.type !== 'keydown') {
 			data.containerPoint = target instanceof L.Marker ?
 					this.latLngToContainerPoint(target.getLatLng()) : this.mouseEventToContainerPoint(e);
 			data.layerPoint = this.containerPointToLayerPoint(data.containerPoint);


More information about the Libreoffice-commits mailing list