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

Mihai Varga mihai.varga at collabora.com
Thu May 28 07:23:08 PDT 2015


 loleaflet/src/control/Control.Parts.js |    7 ++++++-
 loleaflet/src/layer/tile/TileLayer.js  |    7 +++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit d8dd709377812d32b5386e7025c54fbdc13412dd
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu May 28 17:22:42 2015 +0300

    setpart command handler

diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js
index 254c10b..2b198d7 100644
--- a/loleaflet/src/control/Control.Parts.js
+++ b/loleaflet/src/control/Control.Parts.js
@@ -24,6 +24,8 @@ L.Control.Parts = L.Control.extend({
 		this._parts = options.parts;
 		this._currentPart = options.currentPart;
 		this._updateDisabled();
+		map.on('setpart', this._updateDisabled, this);
+
 		return container;
 	},
 
@@ -58,7 +60,10 @@ L.Control.Parts = L.Control.extend({
 		return link;
 	},
 
-	_updateDisabled: function () {
+	_updateDisabled: function (e) {
+		if (e) {
+			this._currentPart = e.currentPart;
+		}
 		var className = 'leaflet-disabled';
 		if (this._currentPart === 0) {
 			L.DomUtil.addClass(this._prevPartButton, className);
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 432d98f..6bcab24 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -251,6 +251,12 @@ L.TileLayer = L.GridLayer.extend({
 				}
 			}
 		}
+		else if (textMsg.startsWith('setpart:')) {
+			this._currentPart = parseInt(textMsg.match(/\d+/g)[0]);
+			this._update();
+			this._clearSelections();
+			this._map.fire('setpart', {currentPart: this._currentPart});
+		}
 		else if (textMsg.startsWith('searchnotfound:')) {
 			this._map.fire('searchnotfound');
 		}
@@ -544,6 +550,7 @@ L.TileLayer = L.GridLayer.extend({
 		}
 		this._update();
 		this._pruneTiles();
+		this._clearSelections();
 	},
 
 	_updateEditViewMode: function (e) {


More information about the Libreoffice-commits mailing list