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

Mihai Varga mihai.varga at collabora.com
Mon Aug 10 23:28:58 PDT 2015


 loleaflet/src/layer/Layer.js          |    6 ------
 loleaflet/src/layer/tile/GridLayer.js |   12 +++++++++++-
 2 files changed, 11 insertions(+), 7 deletions(-)

New commits:
commit aeac42bbc0f3daf841e7b4ea46df80942484395c
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Tue Aug 11 09:28:19 2015 +0300

    loleaflet: moved the socket initialization in the GridLayer

diff --git a/loleaflet/src/layer/Layer.js b/loleaflet/src/layer/Layer.js
index 85c6339..9d6fb1c 100644
--- a/loleaflet/src/layer/Layer.js
+++ b/loleaflet/src/layer/Layer.js
@@ -44,12 +44,6 @@ L.Layer = L.Evented.extend({
 		this._map = map;
 		this._zoomAnimated = map._zoomAnimated;
 
-		if (this._map.socket && !this._map.socket.onopen) {
-			this._map.socket.onopen = L.bind(this._initDocument, this);
-		}
-		if (this._map.socket && !this._map.socket.onmessage) {
-			this._map.socket.onmessage = L.bind(this._onMessage, this);
-		}
 		this.onAdd(map);
 
 		if (this.getAttribution && this._map.attributionControl) {
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 3b38029..ecf4113 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -38,8 +38,17 @@ L.GridLayer = L.Layer.extend({
 
 		this._map._fadeAnimated = false;
 		this._viewReset();
-		this._update();
 		this._map._docLayer = this;
+
+		if (this._map.socket && !this._map.socket.onopen) {
+			this._map.socket.onopen = L.bind(this._initDocument, this);
+		}
+		else if (this._map.socket && this._map.socket.readyState === 1) {
+			this._initDocument();
+		}
+		if (this._map.socket && !this._map.socket.onmessage) {
+			this._map.socket.onmessage = L.bind(this._onMessage, this);
+		}
 	},
 
 	beforeAdd: function (map) {
@@ -51,6 +60,7 @@ L.GridLayer = L.Layer.extend({
 		map._removeZoomLimit(this);
 		this._container = null;
 		this._tileZoom = null;
+		this._map.socket.onmessage = null;
 	},
 
 	bringToFront: function () {


More information about the Libreoffice-commits mailing list