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

Henry Castro hcastro at collabora.com
Thu Aug 27 22:43:38 PDT 2015


 loleaflet/src/control/Control.PartsPreview.js |    7 +++++++
 loleaflet/src/layer/tile/TileLayer.js         |    6 ++++++
 2 files changed, 13 insertions(+)

New commits:
commit 0dc7dca0df8c3550b3adba608e64692a461bcabe
Author: Henry Castro <hcastro at collabora.com>
Date:   Fri Aug 28 01:40:55 2015 -0400

    loleaflet: update images loaded asynchronously

diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 4556111..b09e446 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -10,6 +10,7 @@ L.Control.PartsPreview = L.Control.extend({
 		this._partsPreviewCont = L.DomUtil.create('div', 'parts-preview', docContainer.parentElement);
 
 		map.on('updateparts', this._updateDisabled, this);
+		map.on('updatepart', this._updatePart, this);
 		map.on('tilepreview', this._updatePreview, this);
 		return document.createElement('div');
 	},
@@ -54,6 +55,12 @@ L.Control.PartsPreview = L.Control.extend({
 		}
 	},
 
+	_updatePart: function (e) {
+		if (e.docType === 'presentation') {
+		    this._map.getPartPreview(e.part, e.part, 180, 180);
+		}
+	},
+
 	_updatePreview: function (e) {
 		var id = 'preview-tile' + e.id;
 		// the scrollbar has to be re-initialized here else it doesn't work
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 40156b9..d118ce9 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -68,6 +68,7 @@ L.TileLayer = L.GridLayer.extend({
 		// Position and size of the selection end.
 		this._textSelectionEnd = new L.LatLngBounds(new L.LatLng(0, 0), new L.LatLng(0, 0));
 
+	        this._lastValidPart = -1;
 		// Cursor marker
 		this._cursorMarker = null;
 		// Graphic marker
@@ -341,6 +342,11 @@ L.TileLayer = L.GridLayer.extend({
 					delete this._tileCache[key];
 				}
 			}
+		        if ( command.part === this._currentPart &&
+			     command.part !== this._lastValidPart ) {
+			    this._lastValidPart = command.part;
+			    this._map.fire('updatepart', { part: command.part, docType: this._docType });
+			}
 		}
 		else if (textMsg.startsWith('statechanged:')) {
 			var unoMsg = textMsg.substr(14);


More information about the Libreoffice-commits mailing list