Do not request tiles until we are sure a canonical id is set

Change-Id: Iee15388407ac644e498d3798e545de06038e4b5a
Signed-off-by: Paris Oplopoios <paris.oplopoios@collabora.com>
pull/7218/head
Paris Oplopoios 2023-09-03 17:37:49 +03:00 committed by Paris
parent 5409175a2a
commit 04ac02b033
2 changed files with 23 additions and 2 deletions

View File

@ -127,6 +127,9 @@ L.Map.include({
},
_processPreviewQueue: function() {
if (!this._docLayer._canonicalIdInitialized)
return;
if (this._previewRequestsOnFly > 1) {
// we don't always get a response for each tile requests
// especially when we have more than one view

View File

@ -969,6 +969,7 @@ L.CanvasTileLayer = L.Layer.extend({
this._mentionText = [];
this._moveInProgress = false;
this._canonicalIdInitialized = false;
},
_initContainer: function () {
@ -1807,7 +1808,14 @@ L.CanvasTileLayer = L.Layer.extend({
var canonicalId = payload.split('=')[2].split(' ')[0];
this._debugData['canonicalViewId'].setPrefix('Canonical id changed to: ' + canonicalId + ' for view id: ' + viewId);
}
if (!this._canonicalIdInitialized)
{
this._canonicalIdInitialized = true;
this._update();
}
this._requestNewTiles();
this._invalidateAllPreviews();
this.redraw();
}
else if (textMsg.startsWith('comment:')) {
var obj = JSON.parse(textMsg.substring('comment:'.length + 1));
@ -4879,6 +4887,16 @@ L.CanvasTileLayer = L.Layer.extend({
+ '&tileWidth=' + this._tileHeightTwips);
},
_invalidateAllPreviews: function () {
this._previewInvalidations = [];
for (var key in this._map._docPreviews) {
var preview = this._map._docPreviews[key];
preview.invalid = true;
this._previewInvalidations.push(new L.Bounds(new L.Point(0, 0), new L.Point(preview.maxWidth, preview.maxHeight)));
}
this._invalidatePreviews();
},
_invalidatePreviews: function () {
if (this._map && this._map._docPreviews && this._previewInvalidations.length > 0) {
var toInvalidate = {};
@ -6171,7 +6189,7 @@ L.CanvasTileLayer = L.Layer.extend({
_update: function (center, zoom) {
var map = this._map;
if (!map || this._documentInfo === '') {
if (!map || this._documentInfo === '' || !this._canonicalIdInitialized) {
return;
}
@ -7231,7 +7249,7 @@ L.TilesPreFetcher = L.Class.extend({
if (app.file.fileBasedView && this._docLayer)
this._docLayer._updateFileBasedView();
if (this._docLayer._emptyTilesCount > 0 || !this._map || !this._docLayer) {
if (this._docLayer._emptyTilesCount > 0 || !this._map || !this._docLayer || !this._canonicalIdInitialized) {
return;
}