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

Jan Holesovsky kendy at collabora.com
Mon Feb 8 14:00:10 UTC 2016


 loleaflet/src/core/Socket.js          |   16 ++++++++++++++++
 loleaflet/src/layer/tile/TileLayer.js |   16 ----------------
 2 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit 551c8686527ad342d9ad8853631c013199149802
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Mon Feb 8 14:50:54 2016 +0100

    loleaflet: statusindicator messages must be handled already in the Socket.
    
    Otherwise the messages will be lost - we don't have a docLayer instance yet.

diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 38895ce..cfd9788 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -172,6 +172,22 @@ L.Socket = L.Class.extend({
 			this._map._docLayer = docLayer;
 			this._map.addLayer(docLayer);
 		}
+
+		// these can arrive very early during the startup
+		if (textMsg.startsWith('statusindicatorstart:')) {
+			this._map.fire('statusindicator', {statusType : 'start'});
+			return;
+		}
+		else if (textMsg.startsWith('statusindicatorsetvalue:')) {
+			var value = textMsg.match(/\d+/g)[0];
+			this._map.fire('statusindicator', {statusType : 'setvalue', value : value});
+			return;
+		}
+		else if (textMsg.startsWith('statusindicatorfinish:')) {
+			this._map.fire('statusindicator', {statusType : 'finish'});
+			return;
+		}
+
 		if (this._map._docLayer) {
 			this._map._docLayer._onMessage(textMsg, img);
 		}
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 5b5a206..397b028 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -311,9 +311,6 @@ L.TileLayer = L.GridLayer.extend({
 		else if (textMsg.startsWith('status:')) {
 			this._onStatusMsg(textMsg);
 		}
-		else if (textMsg.startsWith('statusindicator')) {
-			this._onStatusIndicatorMsg(textMsg);
-		}
 		else if (textMsg.startsWith('textselection:')) {
 			this._onTextSelectionMsg(textMsg);
 		}
@@ -608,19 +605,6 @@ L.TileLayer = L.GridLayer.extend({
 		this._map.fire('commandresult', {commandName: commandName, success: success});
 	},
 
-	_onStatusIndicatorMsg: function (textMsg) {
-		if (textMsg.startsWith('statusindicatorstart:')) {
-			this._map.fire('statusindicator', {statusType : 'start'});
-		}
-		else if (textMsg.startsWith('statusindicatorsetvalue:')) {
-			var value = textMsg.match(/\d+/g)[0];
-			this._map.fire('statusindicator', {statusType : 'setvalue', value : value});
-		}
-		else if (textMsg.startsWith('statusindicatorfinish:')) {
-			this._map.fire('statusindicator', {statusType : 'finish'});
-		}
-	},
-
 	_onTextSelectionMsg: function (textMsg) {
 		var strTwips = textMsg.match(/\d+/g);
 		this._selections.clearLayers();


More information about the Libreoffice-commits mailing list