browser: preview: fix invalidate previews when resize

Change-Id: Ic4f4a2cc9e98134564e0a9015b0d4c99bad66e08
Signed-off-by: Henry Castro <hcastro@collabora.com>
pull/8880/head
Henry Castro 2024-04-26 17:00:43 -04:00
parent 53d702b717
commit 91b082fb44
2 changed files with 20 additions and 0 deletions

View File

@ -41,6 +41,8 @@ L.Control.PartsPreview = L.Control.extend({
this._partsPreviewCont = preview;
this._partsPreviewCont.onscroll = this._onScroll.bind(this);
this._idNum = 0;
this._width = 0;
this._height = 0;
},
onAdd: function (map) {
@ -59,6 +61,7 @@ L.Control.PartsPreview = L.Control.extend({
map.on('deletepage', this._deletePreview, this);
map.on('scrolllimits', this._invalidateParts, this);
map.on('scrolltopart', this._scrollToPart, this);
window.addEventListener('resize', L.bind(this._resize, this));
},
createScrollbar: function () {
@ -561,6 +564,20 @@ L.Control.PartsPreview = L.Control.extend({
}
},
_resize: function () {
if (this._height == window.innerHeight &&
this._width == window.innerWidth)
return;
if (this._previewInitialized) {
this._invalidateParts();
this._map._processPreviewQueue();
}
this._height = window.innerHeight;
this._width = window.innerWidth;
},
_updatePreview: function (e) {
if (this._map.isPresentationOrDrawing()) {
this._map._previewRequestsOnFly--;

View File

@ -146,6 +146,9 @@ L.Map.include({
},
_processPreviewQueue: function() {
if (!this._docLayer)
return;
if (!this._docLayer._canonicalIdInitialized)
return;