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

Michael Meeks (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 6 19:46:14 UTC 2019


 loleaflet/src/map/Map.js                  |    8 ++++++--
 loleaflet/src/map/handler/Map.Keyboard.js |    3 +++
 loleaflet/src/map/handler/Map.Mouse.js    |    1 +
 3 files changed, 10 insertions(+), 2 deletions(-)

New commits:
commit 3bd0aea90f4fb168f7445f64ec10ef3febb1392c
Author:     Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Thu Jun 6 20:43:27 2019 +0100
Commit:     Michael Meeks <michael.meeks at collabora.com>
CommitDate: Thu Jun 6 20:45:49 2019 +0100

    Be more aggressive about updating last active time.
    
    Change-Id: I5d269dfe0114fadf41359baa90ceeac4726171e5

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index b419b9201..44bbffd25 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -1071,6 +1071,10 @@ L.Map = L.Evented.extend({
 		this._socket.sendMessage('userinactive');
 	},
 
+	notifyActive : function() {
+		this.lastActiveTime = Date.now();
+	},
+
 	_dimIfInactive: function () {
 		console.debug('_dimIfInactive: diff=' + (Date.now() - this.lastActiveTime));
 		if (this._docLoaded && // don't dim if document hasn't been loaded yet
@@ -1194,9 +1198,9 @@ L.Map = L.Evented.extend({
 	},
 
 	_handleDOMEvent: function (e) {
-		if (!this._docLayer || !this._loaded || !this._enabled || L.DomEvent._skipped(e)) { return; }
+		this.notifyActive();
 
-		this.lastActiveTime = Date.now();
+		if (!this._docLayer || !this._loaded || !this._enabled || L.DomEvent._skipped(e)) { return; }
 
 		// find the layer the event is propagating from
 		var target = this._targets[L.stamp(e.target || e.srcElement)],
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js
index 4e3b51354..9ef49f1b9 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -234,6 +234,7 @@ L.Map.Keyboard = L.Handler.extend({
 	},
 
 	_onMouseDown: function () {
+		this._map.notifyActive();
 		if (this._map._permission === 'edit') {
 			return;
 		}
@@ -246,6 +247,7 @@ L.Map.Keyboard = L.Handler.extend({
 	},
 
 	_onKeyDown: function (e, keyEventFn, compEventFn, inputEle) {
+		this._map.notifyActive();
 		if (this._map.slideShow && this._map.slideShow.fullscreen) {
 			return;
 		}
@@ -399,6 +401,7 @@ L.Map.Keyboard = L.Handler.extend({
 	},
 
 	_onIME: function (e) {
+		this._map.notifyActive();
 		if (e.type === 'compositionstart') {
 			this._isComposing = true; // we are starting composing with IME
 		} else if (e.type === 'compositionupdate') {
diff --git a/loleaflet/src/map/handler/Map.Mouse.js b/loleaflet/src/map/handler/Map.Mouse.js
index 248ef9105..39d2cf722 100644
--- a/loleaflet/src/map/handler/Map.Mouse.js
+++ b/loleaflet/src/map/handler/Map.Mouse.js
@@ -38,6 +38,7 @@ L.Map.Mouse = L.Handler.extend({
 	},
 
 	_onMouseEvent: function (e) {
+		this._map.notifyActive();
 		var docLayer = this._map._docLayer;
 		if (!docLayer || (this._map.slideShow && this._map.slideShow.fullscreen) || this._map.rulerActive) {
 			return;


More information about the Libreoffice-commits mailing list