[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Mon Dec 9 16:38:09 UTC 2019
loleaflet/src/layer/tile/CalcTileLayer.js | 5 ----
loleaflet/src/layer/tile/GridLayer.js | 29 +++++++++++++++------------
loleaflet/src/layer/tile/ImpressTileLayer.js | 5 ----
loleaflet/src/layer/tile/WriterTileLayer.js | 1
4 files changed, 17 insertions(+), 23 deletions(-)
New commits:
commit 9f5374103ba66274e70a48fea5aebcc9a7c419a5
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Dec 9 16:37:23 2019 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 9 16:37:23 2019 +0000
prefetch: disable interval timer when we've pre-fetched everything.
Change-Id: I9d3b3819b3d9a960aa31f729686315e9e5d6d8e1
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index d9ff748a3..4db50a473 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -1278,6 +1278,9 @@ L.GridLayer = L.Layer.extend({
var fragment = document.createDocumentFragment();
this._addTiles(finalQueue, fragment);
this._level.el.appendChild(fragment);
+ } else {
+ clearInterval(this._tilesPreFetcher);
+ this._tilesPreFetcher = undefined;
}
},
@@ -1285,8 +1288,10 @@ L.GridLayer = L.Layer.extend({
if (!this._map) {
return;
}
- clearInterval(this._tilesPreFetcher);
- clearTimeout(this._preFetchIdle);
+ if (this._tilesPreFetcher)
+ clearInterval(this._tilesPreFetcher);
+ if (this._preFetchIdle)
+ clearTimeout(this._preFetchIdle);
if (resetBorder) {
this._preFetchBorder = null;
}
@@ -1295,6 +1300,7 @@ L.GridLayer = L.Layer.extend({
this._preFetchPart = this._selectedPart;
this._preFetchIdle = setTimeout(L.bind(function () {
this._tilesPreFetcher = setInterval(L.bind(this._preFetchTiles, this), interval);
+ this._prefetchIdle = undefined;
}, this), idleTime);
}
});
commit a3319eef792c3db1ec04f2cf20f2183d6895fd68
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Dec 9 16:14:26 2019 +0000
Commit: Michael Meeks <michael.meeks at collabora.com>
CommitDate: Mon Dec 9 16:31:45 2019 +0000
prefetch: cleanup, and avoid constant growth of pre-loading area.
We were inadvertently mutating and growing our copy of the bounds
to fetch here, causing a chunk of un-necessary rendering load,
particularly for spreadsheets.
Change-Id: Ia01565c043d1cb0172cabbec16d941dd8b66dd05
diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index abbcea8b3..511a5253e 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -528,7 +528,6 @@ L.CalcTileLayer = L.TileLayer.extend({
}
else {
// tile outside of the visible area, just remove it
- this._preFetchBorder = null;
this._removeTile(key);
}
}
@@ -646,10 +645,6 @@ L.CalcTileLayer = L.TileLayer.extend({
});
this._resetPreFetching(true);
this._update();
- if (this._preFetchPart !== this._selectedPart) {
- this._preFetchPart = this._selectedPart;
- this._preFetchBorder = null;
- }
}
},
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 7623f7cd8..d9ff748a3 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -1185,6 +1185,7 @@ L.GridLayer = L.Layer.extend({
var zoom = this._map.getZoom();
var tilesToFetch = 10;
var maxBorderWidth = 5;
+ var tileBorderSrc;
if (this._map._permission === 'edit') {
tilesToFetch = 5;
@@ -1192,19 +1193,17 @@ L.GridLayer = L.Layer.extend({
}
if (!this._preFetchBorder) {
- if (this._selectedPart !== this._preFetchPart) {
- // all tiles from the new part have to be pre-fetched
- var tileBorder = this._preFetchBorder = new L.Bounds(new L.Point(0, 0), new L.Point(0, 0));
- }
- else {
- var pixelBounds = this._map.getPixelBounds(center, zoom);
- tileBorder = this._pxBoundsToTileRange(pixelBounds);
- this._preFetchBorder = tileBorder;
- }
+ var pixelBounds = this._map.getPixelBounds(center, zoom);
+ tileBorderSrc = this._pxBoundsToTileRange(pixelBounds);
+ this._preFetchBorder = tileBorderSrc;
}
else {
- tileBorder = this._preFetchBorder;
+ tileBorderSrc = this._preFetchBorder;
}
+
+ // We mutate this - so need a temporary copy
+ var tileBorder = new L.Bounds(tileBorderSrc.min, tileBorderSrc.max);
+
var queue = [],
finalQueue = [],
visitedTiles = {},
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 787411afb..485343cd1 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -633,7 +633,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
}
else {
// tile outside of the visible area, just remove it
- this._preFetchBorder = null;
this._removeTile(key);
}
}
@@ -708,10 +707,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
this._selectedParts = command.selectedParts || [command.selectedPart];
this._resetPreFetching(true);
this._update();
- if (this._preFetchPart !== this._selectedPart) {
- this._preFetchPart = this._selectedPart;
- this._preFetchBorder = null;
- }
var partMatch = textMsg.match(/[^\r\n]+/g);
// only get the last matches
this._partHashes = partMatch.slice(partMatch.length - this._parts);
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index 8b42c775b..c2c4f7850 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -294,7 +294,6 @@ L.WriterTileLayer = L.TileLayer.extend({
}
else {
// tile outside of the visible area, just remove it
- this._preFetchBorder = null;
this._removeTile(key);
}
}
More information about the Libreoffice-commits
mailing list