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

Henry Castro hcastro at collabora.com
Thu Sep 8 16:13:43 UTC 2016


 loleaflet/src/control/Parts.js        |    1 +
 loleaflet/src/layer/tile/TileLayer.js |   21 ++++++++++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

New commits:
commit 878fff5ebb78b58bbcb5c49516eed8f7215111e5
Author: Henry Castro <hcastro at collabora.com>
Date:   Thu Sep 8 12:11:07 2016 -0400

    loleaflet: fix part not taken into account for cell cursors

diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index db63f95..45fd68d 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -32,6 +32,7 @@ L.Map.include({
 		});
 		this._socket.sendMessage('setclientpart part=' + docLayer._selectedPart);
 		docLayer._updateViewCursors();
+		docLayer._updateCellViewCursors();
 		docLayer._clearSelections();
 		docLayer._updateOnChangePart();
 		docLayer._pruneTiles();
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 6fb3c1b..8b40da6 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -653,6 +653,7 @@ L.TileLayer = L.GridLayer.extend({
 				this._twipsToLatLng(bottomRightTwips, this._map.getZoom()));
 		}
 
+		this._cellViewCursors[viewId].part = parseInt(obj.part);
 		this._onUpdateCellViewCursor(viewId);
 	},
 
@@ -661,23 +662,19 @@ L.TileLayer = L.GridLayer.extend({
 			return;
 
 		var cellViewCursorsMarker = this._cellViewCursors[viewId].marker;
-		if (!this._isEmptyRectangle(this._cellViewCursors[viewId].bounds)) {
+		var viewPart = this._cellViewCursors[viewId].part;
 
-			if (cellViewCursorsMarker) {
-				this._map.removeLayer(cellViewCursorsMarker);
-			}
-			cellViewCursorsMarker = L.rectangle(this._cellViewCursors[viewId].bounds, {fill: false, color: L.LOUtil.getViewIdHexColor(viewId), weight: 2});
+		if (!this._isEmptyRectangle(this._cellViewCursors[viewId].bounds) && this._selectedPart === viewPart) {
 			if (!cellViewCursorsMarker) {
-				this._map.fire('error', {msg: 'Cell View Cursor marker initialization', cmd: 'cellViewCursor', kind: 'failed', id: 1});
-				return;
+				cellViewCursorsMarker = L.rectangle(this._cellViewCursors[viewId].bounds, {fill: false, color: L.LOUtil.getViewIdHexColor(viewId), weight: 2});
+				this._cellViewCursors[viewId].marker = cellViewCursorsMarker;
 			}
+			cellViewCursorsMarker.setBounds(this._cellViewCursors[viewId].bounds);
 			this._map.addLayer(cellViewCursorsMarker);
 		}
 		else if (cellViewCursorsMarker) {
 			this._map.removeLayer(cellViewCursorsMarker);
 		}
-
-		this._cellViewCursors[viewId].marker = cellViewCursorsMarker;
 	},
 
 	_onViewCursorVisibleMsg: function(textMsg) {
@@ -1198,6 +1195,12 @@ L.TileLayer = L.GridLayer.extend({
 		}
 	},
 
+	_updateCellViewCursors: function () {
+		for (var key in this._cellViewCursors) {
+			this._onUpdateCellViewCursor(key);
+		}
+	},
+
 	// Update dragged graphics selection resize.
 	_onGraphicEdit: function (e) {
 		if (!e.handle) { return; }


More information about the Libreoffice-commits mailing list