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

Mihai Varga mihai.varga at collabora.com
Thu Sep 3 00:34:03 PDT 2015


 loleaflet/src/control/Parts.js               |    2 +-
 loleaflet/src/layer/tile/CalcTileLayer.js    |    1 -
 loleaflet/src/layer/tile/ImpressTileLayer.js |    1 -
 loleaflet/src/layer/tile/TileLayer.js        |   14 +++++++++++---
 loleaflet/src/map/handler/Map.Mouse.js       |    4 ++++
 5 files changed, 16 insertions(+), 6 deletions(-)

New commits:
commit 159e668b01c66312ad8ca209b7cc63e6fb910edd
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Sep 3 10:33:20 2015 +0300

    loleaflet: hide selection when switching thorugh cached parts

diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index 040d909..55d4c9b 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -31,9 +31,9 @@ L.Map.include({
 			docType: docLayer._docType
 		});
 		L.Socket.sendMessage('setclientpart part=' + docLayer._selectedPart);
+		docLayer._clearSelections();
 		docLayer._update();
 		docLayer._pruneTiles();
-		docLayer._clearSelections();
 		docLayer._prevSelectedPartNeedsUpdate = true;
 		if (docLayer._invalidatePreview) {
 			docLayer._invalidatePreview();
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index 7550ddb..d405e2d 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -91,7 +91,6 @@ L.CalcTileLayer = L.TileLayer.extend({
 		if (part !== this._selectedPart) {
 			this._selectedPart = part;
 			this._update();
-			this._clearSelections();
 			this._map.fire('setpart', {selectedPart: this._selectedPart});
 		}
 	},
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 2acc5c3..1717cf3 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -97,7 +97,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
 		if (part !== this._selectedPart) {
 			this._selectedPart = part;
 			this._update();
-			this._clearSelections();
 			this._map.fire('setpart', {selectedPart: this._selectedPart});
 		}
 	},
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index ae722bd..2050675 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -105,7 +105,6 @@ L.TileLayer = L.GridLayer.extend({
 		map._fadeAnimated = false;
 		this._viewReset();
 		map.on('drag resize zoomend', this._updateScrollOffset, this);
-		map.on('clearselection', this._clearSelections, this);
 		map.on('copy', this._onCopy, this);
 		map.on('zoomend', this._onUpdateCursor, this);
 		map.on('dragstart', this._onDragStart, this);
@@ -300,7 +299,7 @@ L.TileLayer = L.GridLayer.extend({
 
 	_onTextSelectionMsg: function (textMsg) {
 		var strTwips = textMsg.match(/\d+/g);
-		this._clearSelections();
+		this._selections.clearLayers();
 		if (strTwips != null) {
 			var rectangles = [];
 			var selectionCenter = new L.Point(0, 0);
@@ -438,7 +437,16 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_clearSelections: function () {
+		// hide the cursor
+		this._isCursorOverlayVisible = false;
+		this._onUpdateCursor();
+		// hide the text selection
 		this._selections.clearLayers();
+		// hide the selection handles
+		this._onUpdateTextSelection();
+		// hide the graphic selection
+		this._graphicSelection = null;
+		this._onUpdateGraphicSelection();
 	},
 
 	_postMouseEvent: function(type, x, y, count) {
@@ -534,7 +542,7 @@ L.TileLayer = L.GridLayer.extend({
 
 	// Update group layer selection handler.
 	_onUpdateGraphicSelection: function () {
-		if (!this._isEmptyRectangle(this._graphicSelection)) {
+		if (this._graphicSelection && !this._isEmptyRectangle(this._graphicSelection)) {
 			if (this._graphicMarker) {
 				this._graphicMarker.off('editstart editend', this._onGraphicEdit, this);
 				this._map.removeLayer(this._graphicMarker);
commit 722257508fb56a51efecc16e04c2babd7c4824d5
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Thu Sep 3 09:49:55 2015 +0300

    loleaflet: don't handle mouse events before the doc is loaded

diff --git a/loleaflet/src/map/handler/Map.Mouse.js b/loleaflet/src/map/handler/Map.Mouse.js
index 9049084..a5f58f1 100644
--- a/loleaflet/src/map/handler/Map.Mouse.js
+++ b/loleaflet/src/map/handler/Map.Mouse.js
@@ -25,6 +25,10 @@ L.Map.Mouse = L.Handler.extend({
 
 	_onMouseEvent: function (e) {
 		var docLayer = this._map._docLayer;
+		if (!docLayer) {
+			// document not yet loaded
+			return;
+		}
 		if (docLayer._graphicMarker && docLayer._graphicMarker.isDragged) {
 			return;
 		}


More information about the Libreoffice-commits mailing list