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

Mihai Varga mihai.mv13 at gmail.com
Thu Jun 25 03:25:24 PDT 2015


 loleaflet/src/layer/tile/GridLayer.js |   12 +++++++-----
 loleaflet/src/layer/tile/TileLayer.js |    4 +++-
 2 files changed, 10 insertions(+), 6 deletions(-)

New commits:
commit e9691e6557ec170654be50ce78d4f1f51f7ded52
Author: Mihai Varga <mihai.mv13 at gmail.com>
Date:   Thu Jun 25 13:25:03 2015 +0300

    Enable fadeAnimated only when zooming/scrolling

diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 1996cad..7961688 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -333,6 +333,7 @@ L.GridLayer = L.Layer.extend({
 
 			this._tileZoom = tileZoom;
 			if (tileZoomChanged) {
+				this._map._fadeAnimated = true;
 				this._updateTileTwips();
 				this._updateMaxBounds();
 			}
@@ -437,6 +438,7 @@ L.GridLayer = L.Layer.extend({
 	},
 
 	_move: function () {
+		this._fadeAnimated = true;
 		this._update();
 	},
 
@@ -673,17 +675,17 @@ L.GridLayer = L.Layer.extend({
 		if (!tile) { return; }
 
 		tile.loaded = +new Date();
-		if (tile._skipAnim) {
-			this._tiles[key]._skipAnim = null;
-			return;
-		}
 		if (this._map._fadeAnimated) {
 			L.DomUtil.setOpacity(tile.el, 0);
 			L.Util.cancelAnimFrame(this._fadeFrame);
 			this._fadeFrame = L.Util.requestAnimFrame(this._updateOpacity, this);
 		} else {
 			tile.active = true;
-			this._pruneTiles();
+			if (tile._skipPrune) {
+				// avoid running the algorithm when we just replace a tile
+				this._pruneTiles();
+			}
+			this._tiles[key]._skipPrune = false;
 		}
 
 		L.DomUtil.addClass(tile.el, 'leaflet-tile-loaded');
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 2033265..1a756ee 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -309,6 +309,8 @@ L.TileLayer = L.GridLayer.extend({
 			var bottomRightTwips = topLeftTwips.add(offset);
 			var invalidBounds = new L.Bounds(topLeftTwips, bottomRightTwips);
 
+			this._map._fadeAnimated = false;
+
 			for (var key in this._tiles) {
 				var coords = this._tiles[key].coords;
 				var point1 = this._coordsToTwips(coords);
@@ -370,7 +372,7 @@ L.TileLayer = L.GridLayer.extend({
 			var tile = this._tiles[key];
 			if (tile) {
 				if (tile.el.src) {
-					this._tiles[key]._skipAnim = true;
+					this._tiles[key]._skipPrune = true;
 				}
 				tile.el.src = 'data:image/png;base64,' + window.btoa(strBytes);
 			}


More information about the Libreoffice-commits mailing list