[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-3' - loleaflet/src

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Aug 28 08:44:01 UTC 2018


 loleaflet/src/layer/tile/GridLayer.js |   49 ++++++++++++++++++----------------
 1 file changed, 26 insertions(+), 23 deletions(-)

New commits:
commit d331ddee38ff27cfad95ab821786c55fde85e29a
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Sun Aug 26 06:11:08 2018 +0200
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Tue Aug 28 10:43:43 2018 +0200

    loleaflet: Request invalid tiles too by view change
    
    Change-Id: I43c65ce025d3b18bd664d2ad16107cf828bab300
    (cherry picked from commit 9473908d45a884827356b504c5f768e2f29cc46b)
    Reviewed-on: https://gerrit.libreoffice.org/59650
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Tested-by: Andras Timar <andras.timar at collabora.com>

diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index a337e3835..3bd563639 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -532,7 +532,8 @@ L.GridLayer = L.Layer.extend({
 
 				key = this._tileCoordsToKey(coords);
 				var tile = this._tiles[key];
-				if (tile) {
+				var invalid = tile && tile._invalidCount && tile._invalidCount > 0;
+				if (tile && tile.loaded && !invalid) {
 					tile.current = true;
 					newView = false;
 				} else {
@@ -866,34 +867,36 @@ L.GridLayer = L.Layer.extend({
 			key = this._tileCoordsToKey(coords);
 
 			if (coords.part === this._selectedPart) {
-				var tile = this.createTile(this._wrapCoords(coords), L.bind(this._tileReady, this, coords));
+				if (!this._tiles[key]) {
+					var tile = this.createTile(this._wrapCoords(coords), L.bind(this._tileReady, this, coords));
 
-				this._initTile(tile);
+					this._initTile(tile);
 
-				// if createTile is defined with a second argument ("done" callback),
-				// we know that tile is async and will be ready later; otherwise
-				if (this.createTile.length < 2) {
-					// mark tile as ready, but delay one frame for opacity animation to happen
-					setTimeout(L.bind(this._tileReady, this, coords, null, tile), 0);
-				}
+					// if createTile is defined with a second argument ("done" callback),
+					// we know that tile is async and will be ready later; otherwise
+					if (this.createTile.length < 2) {
+						// mark tile as ready, but delay one frame for opacity animation to happen
+						setTimeout(L.bind(this._tileReady, this, coords, null, tile), 0);
+					}
 
-				// we prefer top/left over translate3d so that we don't create a HW-accelerated layer from each tile
-				// which is slow, and it also fixes gaps between tiles in Safari
-				L.DomUtil.setPosition(tile, tilePos, true);
+					// we prefer top/left over translate3d so that we don't create a HW-accelerated layer from each tile
+					// which is slow, and it also fixes gaps between tiles in Safari
+					L.DomUtil.setPosition(tile, tilePos, true);
 
-				// save tile in cache
-				this._tiles[key] = {
-					el: tile,
-					coords: coords,
-					current: true
-				};
+					// save tile in cache
+					this._tiles[key] = {
+						el: tile,
+						coords: coords,
+						current: true
+					};
 
-				fragment.appendChild(tile);
+					fragment.appendChild(tile);
 
-				this.fire('tileloadstart', {
-					tile: tile,
-					coords: coords
-				});
+					this.fire('tileloadstart', {
+						tile: tile,
+						coords: coords
+					});
+				}
 			}
 
 			if (this._tileCache[key]) {


More information about the Libreoffice-commits mailing list