loleaflet/src/control/Control.PartsPreview.js | 9 ++++++--- loleaflet/src/control/Parts.js | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-)
New commits: commit b47e5a670270fcf72dbec330099c20c17fbcd807 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Fri Jul 3 15:59:32 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Tue Aug 11 21:45:45 2020 +0200 loleaflet: fix the bounding rectangle when not visible The preview thumbnail in mobile wizard are not visible yet, so assume the map container rectangle bounds to properly calculate the aspect ratio of the image Change-Id: Iacc387b92e326965c86fb60d1acfde5b49365ad3 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97899 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Henry Castro <hcas...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/online/+/100551 diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js index 3468d8e2e..e6006a8f3 100644 --- a/loleaflet/src/control/Control.PartsPreview.js +++ b/loleaflet/src/control/Control.PartsPreview.js @@ -232,6 +232,11 @@ L.Control.PartsPreview = L.Control.extend({ var previewContBB = this._partsPreviewCont.getBoundingClientRect(); var bottomBound; + // is not visible yet, assume map bounds + if (previewContBB.right === 0 && previewContBB.bottom === 0) { + previewContBB = this._map._container.getBoundingClientRect(); + } + if (this._direction === 'x') { this._previewContTop = previewContBB.left; bottomBound = previewContBB.right + previewContBB.width / 2; @@ -270,9 +275,7 @@ L.Control.PartsPreview = L.Control.extend({ var imgSize; if (i === 0 || (previewFrameTop >= topBound && previewFrameTop <= bottomBound) || (previewFrameBottom >= topBound && previewFrameBottom <= bottomBound)) { - imgSize = this.options.fetchThumbnail ? - this._map.getPreview(i, i, this.options.maxWidth, this.options.maxHeight, {autoUpdate: this.options.autoUpdate}) : - { width: this.options.maxWidth, height: this.options.maxHeight }; + imgSize = this._map.getPreview(i, i, this.options.maxWidth, this.options.maxHeight, {autoUpdate: this.options.autoUpdate, fetchThumbnail: this.options.fetchThumbnail}); img.fetched = true; if (this._direction === 'x') { diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js index 18ba9084d..d112557f7 100644 --- a/loleaflet/src/control/Parts.js +++ b/loleaflet/src/control/Parts.js @@ -103,6 +103,7 @@ L.Map.include({ } var autoUpdate = options ? !!options.autoUpdate : false; var forAllClients = options ? !!options.broadcast : false; + var fetchThumbnail = options && options.fetchThumbnail ? options.fetchThumbnail : true; this._docPreviews[id] = {id: id, index: index, maxWidth: maxWidth, maxHeight: maxHeight, autoUpdate: autoUpdate, invalid: false}; var docLayer = this._docLayer; @@ -131,7 +132,8 @@ L.Map.include({ dpiscale = 2; // some may be hidpi, and it is fine to send the hi-dpi slide preview to non-hpi clients } - this._socket.sendMessage('tile ' + + if (fetchThumbnail) { + this._socket.sendMessage('tile ' + 'nviewid=0' + ' ' + 'part=' + part + ' ' + 'width=' + maxWidth * dpiscale + ' ' + @@ -141,7 +143,8 @@ L.Map.include({ 'tilewidth=' + tileWidth + ' ' + 'tileheight=' + tileHeight + ' ' + 'id=' + id + ' ' + - 'broadcast=' + (forAllClients ? 'yes' : 'no')); + 'broadcast=' + (forAllClients ? 'yes' : 'no')); + } return {width: maxWidth, height: maxHeight}; }, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits