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

Ashod Nakashian ashod.nakashian at collabora.co.uk
Sat Apr 23 13:27:57 UTC 2016


 loleaflet/src/core/Socket.js |    1 +
 loleaflet/src/map/Map.js     |   30 ++++++++++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

New commits:
commit c37d6720fd23420752cdc56331afca30c25122fe
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date:   Fri Apr 22 17:44:14 2016 -0400

    loleaflet: remove text selection when inactive
    
    Change-Id: I5e983062a39d50b45435af6f1cc51073f1c31e7e
    Reviewed-on: https://gerrit.libreoffice.org/24315
    Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
    Tested-by: Ashod Nakashian <ashnakash at gmail.com>

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index b8886d3..d2ce2ec 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -161,6 +161,7 @@ L.Socket = L.Class.extend({
 			this._map.fail = true;
 		}
 		else if (textMsg.startsWith('statusindicator:')) {
+			//FIXME: We should get statusindicator when saving too, no?
 			this._map.showBusy('Connecting...', false);
 		}
 		else if (!textMsg.startsWith('tile:') && !textMsg.startsWith('renderfont:')) {
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index a734bc5..14f5ced 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -2,18 +2,28 @@
  * L.Map is the central class of the API - it is used to create a map.
  */
 
-function activate(socket)
+function activate(map)
 {
-	socket.sendMessage('useractive');
 	clearTimeout(vex.timer);
+	if (map._socket) {
+		map._socket.sendMessage('useractive');
+	}
+
 	return vex.close(vex.globalID - 1);
 }
 
-function deactivate(socket)
+function deactivate(map)
 {
-	socket.sendMessage('userinactive');
 	clearTimeout(vex.timer);
 
+	if (map._socket) {
+		map._socket.sendMessage('userinactive');
+	}
+
+	if (map._docLayer) {
+		map._docLayer._onMessage('textselection:', null);
+	}
+
 	options = $.extend({}, vex.defaultOptions, {contentCSS: {"background":"rgba(0, 0, 0, 0)"}});
 	options.id = vex.globalID;
 	vex.globalID += 1;
@@ -28,7 +38,7 @@ function deactivate(socket)
 	  if (e.target !== this) {
 	    return;
 	  }
-	  return activate(socket);
+	  return activate(map);
 	});
 	options.$vex.append(options.$vexOverlay);
 
@@ -41,15 +51,15 @@ function deactivate(socket)
 	vex.setupBodyClassName(options.$vex);
 }
 
-function dim(bool, socket)
+function dim(bool, map)
 {
 	if (bool)
 	{
-		vex.timer = setTimeout(function() { deactivate(socket); }, 10 * 1000);
+		vex.timer = setTimeout(function() { deactivate(map); }, 10 * 1000);
 	}
 	else
 	{
-		activate(socket);
+		activate(map);
 	}
 }
 
@@ -747,7 +757,7 @@ L.Map = L.Evented.extend({
 			doclayer._onUpdateCursor();
 		}
 
-		dim(true, this._socket);
+		dim(true, this);
 	},
 
 	_onGotFocus: function () {
@@ -764,7 +774,7 @@ L.Map = L.Evented.extend({
 			}, 300);
 		}
 
-		dim(false, this._socket);
+		dim(false, this);
 	},
 
 	_onUpdateProgress: function (e) {


More information about the Libreoffice-commits mailing list