[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4-0' - loleaflet/src
Michael Meeks (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jan 6 15:23:03 UTC 2020
loleaflet/src/layer/tile/CalcTileLayer.js | 5 -----
loleaflet/src/layer/tile/GridLayer.js | 19 +++++++++----------
loleaflet/src/layer/tile/ImpressTileLayer.js | 5 -----
loleaflet/src/layer/tile/WriterTileLayer.js | 1 -
4 files changed, 9 insertions(+), 21 deletions(-)
New commits:
commit b45cd6cf9faed0eaf205cd8fca5cfdc097485a27
Author: Michael Meeks <michael.meeks at collabora.com>
AuthorDate: Mon Dec 9 16:14:26 2019 +0000
Commit: Andras Timar <andras.timar at collabora.com>
CommitDate: Mon Jan 6 16:22:40 2020 +0100
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
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/84775
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/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index b616155b0..0fa62bcef 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -274,7 +274,6 @@ L.CalcTileLayer = L.TileLayer.extend({
}
else {
// tile outside of the visible area, just remove it
- this._preFetchBorder = null;
this._removeTile(key);
}
}
@@ -392,10 +391,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 9999bbb48..2850c88cf 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -1168,6 +1168,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;
@@ -1175,19 +1176,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 b19fdd0c0..7fd9db2f2 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -407,7 +407,6 @@ L.ImpressTileLayer = L.TileLayer.extend({
}
else {
// tile outside of the visible area, just remove it
- this._preFetchBorder = null;
this._removeTile(key);
}
}
@@ -479,10 +478,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 ece0ddfa4..53ad67489 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -135,7 +135,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