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

Henry Castro hcastro at collabora.com
Tue May 26 17:39:19 PDT 2015


 loleaflet/src/layer/tile/TileLayer.js |   30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

New commits:
commit 8d094fbf3fa051d740be21b2d9772efb0c0a59a3
Author: Henry Castro <hcastro at collabora.com>
Date:   Tue May 26 20:37:11 2015 -0400

    Added keypress function to send keys

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index acbe575..e082883 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -74,6 +74,25 @@ L.TileLayer = L.GridLayer.extend({
 		this._map.on('drag', this._updateScrollOffset, this);
 	},
 
+	getEvents: function () {
+		var events = {
+			viewreset: this._viewReset,
+			moveend: this._move,
+			keypress: this._onKeyPress
+		};
+
+		if (!this.options.updateWhenIdle) {
+			// update tiles on move, but not more often than once per given interval
+			events.move = L.Util.throttle(this._move, this.options.updateInterval, this);
+		}
+
+		if (this._zoomAnimated) {
+			events.zoomanim = this._animateZoom;
+		}
+
+		return events;
+	},
+
 	setUrl: function (url, noRedraw) {
 		this._url = url;
 
@@ -422,6 +441,11 @@ L.TileLayer = L.GridLayer.extend({
 				' x=' + x + ' y=' + y + ' count=' + count);
 	},
 
+	_postKeyboardEvent: function(type, charcode, keycode) {
+		this._map.socket.send('key type=' + type +
+				' char=' + charcode + ' key=' + keycode);
+	},
+
 	_onMouseEvent: function (e) {
 		if (e.type === 'mousedown') {
 			this._selecting = true;
@@ -493,6 +517,12 @@ L.TileLayer = L.GridLayer.extend({
 			this._map.on('mousedown mouseup mouseover mouseout mousemove dblclick',
 					this._onMouseEvent, this);
 		}
+	},
+
+	_onKeyPress: function (e) {
+		if (this._cursorMarker) {
+			this._postKeyboardEvent('input', e.originalEvent.charCode, e.originalEvent.keyCode);
+		}
 	}
 });
 


More information about the Libreoffice-commits mailing list