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

Mihai Varga mihai.varga at collabora.com
Thu Aug 6 23:46:16 PDT 2015


 loleaflet/spec/tilebench/TileBenchSpec.js |   28 +++++++++++++++++-----------
 loleaflet/src/layer/tile/TileLayer.js     |    2 +-
 2 files changed, 18 insertions(+), 12 deletions(-)

New commits:
commit 50399b8dba13aed19d895e4a83ff1d4fd09c2589
Author: Mihai Varga <mihai.varga at collabora.com>
Date:   Fri Aug 7 09:44:10 2015 +0300

    loleaflet: fire 'alltilesloaded' as a statusindicator event
    
    This is fired all the new (empty) tiles have been loaded.
    This is not fire for prefetched tiles

diff --git a/loleaflet/spec/tilebench/TileBenchSpec.js b/loleaflet/spec/tilebench/TileBenchSpec.js
index 28ac2b0..a31a0b6 100644
--- a/loleaflet/spec/tilebench/TileBenchSpec.js
+++ b/loleaflet/spec/tilebench/TileBenchSpec.js
@@ -50,7 +50,7 @@ describe('TileBench', function () {
 	});
 
 	afterEach(function () {
-		map.off('alltilesloaded');
+		map.off('statusindicator');
 	});
 
 	after(function () {
@@ -61,9 +61,11 @@ describe('TileBench', function () {
 
 	describe('Benchmarking', function () {
 		it('Load all new tiles', function (done) {
-			map.on('alltilesloaded', L.bind(function () {
-				loadCount += 1;
-				done();
+			map.on('statusindicator', L.bind(function (e) {
+				if (e.statusType === 'alltilesloaded') {
+					loadCount += 1;
+					done();
+				}
 			}, done));
 
 		});
@@ -75,9 +77,11 @@ describe('TileBench', function () {
 			var aproxTime = keyInput[keyInput.length - 1][0] + 2000;
 
 			setTimeout(L.bind(function () {
-				map.on('alltilesloaded', L.bind(function () {
-					loadCount += 1;
-					getTimes(done);
+				map.on('statusindicator', L.bind(function (e) {
+					if (e.statusType === 'alltilesloaded') {
+						loadCount += 1;
+						getTimes(done);
+					}
 				}, done));
 
 
@@ -115,10 +119,12 @@ describe('TileBench', function () {
 					done();
 				}
 				else {
-					map.on('alltilesloaded', L.bind(function () {
-						loadCount += 1;
-						clearTimeout(this.timeOut);
-						done();
+					map.on('statusindicator', L.bind(function (e) {
+						if (e.statusType === 'alltilesloaded') {
+							loadCount += 1;
+							clearTimeout(this.timeOut);
+							done();
+						}
 					}, done));
 				}
 			}, done), 3200);
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index fd021b0..64f15b9 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -426,7 +426,7 @@ L.TileLayer = L.GridLayer.extend({
 				if (!tile.loaded) {
 					this._emptyTilesCount -= 1;
 					if (this._emptyTilesCount === 0) {
-						this._map.fire('alltilesloaded');
+						this._map.fire('statusindicator', {statusType: 'alltilesloaded'});
 					}
 				}
 				tile.el.src = img;


More information about the Libreoffice-commits mailing list