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

László Németh laszlo.nemeth at collabora.com
Wed Sep 28 11:26:08 UTC 2016


 loleaflet/src/layer/tile/CalcTileLayer.js    |    7 ++-----
 loleaflet/src/layer/tile/GridLayer.js        |    4 ++--
 loleaflet/src/layer/tile/ImpressTileLayer.js |    7 ++-----
 loleaflet/src/layer/tile/TileLayer.js        |   26 +++++++++++++++++++-------
 loleaflet/src/layer/tile/WriterTileLayer.js  |    7 ++-----
 5 files changed, 27 insertions(+), 24 deletions(-)

New commits:
commit 0b454bccfc42f35c6df996a2a666d4e42dc59f76
Author: László Németh <laszlo.nemeth at collabora.com>
Date:   Wed Sep 28 13:17:46 2016 +0200

    loleaflet: cleanup of tile debugging mode

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index c14cd5f..1157f60 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -67,11 +67,8 @@ L.CalcTileLayer = L.TileLayer.extend({
 					}
 					tilePositionsY += tileTopLeft.y;
 					needsNewTiles = true;
-					if (this._debug && this._tiles[key]._debugTile) {
-						this._tiles[key]._debugTile.setStyle({fillOpacity: 0.5});
-						this._tiles[key]._debugTime.date = +new Date();
-						this._tiles[key]._debugInvalidateCount++;
-						this._debugInvalidateCount++;
+					if (this._debug) {
+						this._debugAddInvalidationData(this._tiles[key]);
 					}
 				}
 				else {
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index d48aed9..3141c65 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -538,9 +538,9 @@ L.GridLayer = L.Layer.extend({
 					if (!this._tiles[key].loaded) {
 						L.DomUtil.remove(this._tiles[key].el);
 						delete this._tiles[key];
-						if (this._debug && this._debugDataCancelledTiles) {
+						if (this._debug) {
 							this._debugCancelledTiles++;
-							this._debugDataCancelledTiles.setPrefix('Cancelled tiles: ' + this._debugCancelledTiles);
+							this._debugShowTotalData();
 						}
 					}
 				}
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 677e592..8a2f70b 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -51,11 +51,8 @@ L.ImpressTileLayer = L.TileLayer.extend({
 					}
 					tilePositionsY += tileTopLeft.y;
 					needsNewTiles = true;
-					if (this._debug && this._tiles[key]._debugTile) {
-						this._tiles[key]._debugTile.setStyle({fillOpacity: 0.5});
-						this._tiles[key]._debugTime.date = +new Date();
-						this._tiles[key]._debugInvalidateCount++;
-						this._debugInvalidateCount++;
+					if (this._debug) {
+						this._debugAddInvalidationData(this._tiles[key]);
 					}
 				}
 				else {
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 62cae49..552f408 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -385,7 +385,6 @@ L.TileLayer = L.GridLayer.extend({
 		}
 		if (!this._debug) {
 			this._debugDataPING.setPrefix('');
-			this._debugDataCancelledTiles.setPrefix('');
 			this._debugDataTileCombine.setPrefix('');
 			this._debugDataFromKeyInputToInvalidate.setPrefix('');
 		}
@@ -1025,7 +1024,7 @@ L.TileLayer = L.GridLayer.extend({
 			if (tile._debugTile) {
 				tile._debugTile.setStyle({fillOpacity: 0});
 			}
-			this._debugDataLoadCount.setPrefix('Total of requested tiles: ' + this._debugInvalidateCount + ', received: ' + this._debugLoadCount);
+			this._debugShowTileData();
 		}
 		if (command.id !== undefined) {
 			this._map.fire('tilepreview', {
@@ -1769,7 +1768,13 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_debugGetTimeArray: function() {
-		return {count: 0, ms: 0, best: Number.MAX_SAFE_INTEGER, worst: 0, last: 0, date: 0};
+		return {count: 0, ms: 0, best: Number.MAX_SAFE_INTEGER, worst: 0, date: 0};
+	},
+
+	_debugShowTileData: function() {
+		this._debugDataLoadCount.setPrefix('Total of requested tiles: ' +
+				this._debugInvalidateCount + ', received: ' + this._debugLoadCount +
+				', cancelled: ' + this._debugCancelledTiles);
 	},
 
 	_debugInit: function() {
@@ -1783,9 +1788,8 @@ L.TileLayer = L.GridLayer.extend({
 			this._debugCancelledTiles = 0;
 			this._debugLoadCount = 0;
 			this._debugInvalidateCount = 0;
-			if (!this._debugDataCancelledTiles) {
+			if (!this._debugDataTileCombine) {
 				this._debugDataTileCombine = L.control.attribution({prefix: '', position: 'bottomleft'}).addTo(map);
-				this._debugDataCancelledTiles = L.control.attribution({prefix: '', position: 'bottomleft'}).addTo(map);
 				this._debugDataFromKeyInputToInvalidate = L.control.attribution({prefix: '', position: 'bottomleft'}).addTo(map);
 				this._debugDataPING = L.control.attribution({prefix: '', position: 'bottomleft'}).addTo(map);
 				this._debugDataLoadCount = L.control.attribution({prefix: '', position: 'bottomleft'}).addTo(map);
@@ -1798,7 +1802,6 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_debugSetTimes: function(times, value) {
-		times.last = value;
 		if (value < times.best) {
 			times.best = value;
 		}
@@ -1828,6 +1831,15 @@ L.TileLayer = L.GridLayer.extend({
 		}
 	},
 
+	_debugAddInvalidationData: function(tile) {
+		if (tile._debugTile) {
+			tile._debugTile.setStyle({fillOpacity: 0.5});
+			tile._debugTime.date = +new Date();
+			tile._debugInvalidateCount++;
+			this._debugInvalidateCount++;
+		}
+	},
+
 	_debugAddInvalidationMessage: function(message) {
 		this._debugInvalidBoundsMessage[this._debugId - 1] = message;
 		var messages = '';
@@ -1837,7 +1849,7 @@ L.TileLayer = L.GridLayer.extend({
 			}
 		}
 		this._debugDataTileCombine.setPrefix(messages);
-		this._debugDataLoadCount.setPrefix('Total of requested tiles: ' + this._debugInvalidateCount + ', received: ' + this._debugLoadCount);
+		this._debugShowTileData();
 	},
 
 	_debugTimeout: function() {
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index f5299dc..3b34125 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -50,11 +50,8 @@ L.WriterTileLayer = L.TileLayer.extend({
 					}
 					tilePositionsY += tileTopLeft.y;
 					needsNewTiles = true;
-					if (this._debug && this._tiles[key]._debugTile) {
-						this._tiles[key]._debugTile.setStyle({fillOpacity: 0.5});
-						this._tiles[key]._debugTime.date = +new Date();
-						this._tiles[key]._debugInvalidateCount++;
-						this._debugInvalidateCount++;
+					if (this._debug) {
+						this._debugAddInvalidationData(this._tiles[key]);
 					}
 				}
 				else {


More information about the Libreoffice-commits mailing list