loleaflet/src/control/Control.PartsPreview.js | 38 +++++++++++--------------- 1 file changed, 17 insertions(+), 21 deletions(-)
New commits: commit 7bf6c0604376bb0f1a33fdcc81e67ccf9b84c6f6 Author: Henry Castro <hcas...@collabora.com> AuthorDate: Thu Jul 2 15:13:12 2020 -0400 Commit: Henry Castro <hcas...@collabora.com> CommitDate: Tue Aug 11 21:45:04 2020 +0200 loleafet: simplify to compute the bottom bound of the preview thumbnails Change-Id: I5ee8c5b4182b2752821fcd3bba022bc4b3db42d1 Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97778 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/+/100549 diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js index 84b8a1579..934b4b179 100644 --- a/loleaflet/src/control/Control.PartsPreview.js +++ b/loleaflet/src/control/Control.PartsPreview.js @@ -86,18 +86,9 @@ L.Control.PartsPreview = L.Control.extend({ $('.scroll-container').mCustomScrollbar('update'); }, this), 500); } - var previewContBB = this._partsPreviewCont.getBoundingClientRect(); - var bottomBound; this.createScrollbar(); - - if (this._direction === 'x') { - this._previewContTop = previewContBB.left; - bottomBound = previewContBB.right + previewContBB.width / 2; - } else { - this._previewContTop = previewContBB.top; - bottomBound = previewContBB.bottom + previewContBB.height / 2; - } + var bottomBound = this._getBottomBound(); this._map.on('click', function() { this.partsFocused = false; @@ -182,17 +173,7 @@ L.Control.PartsPreview = L.Control.extend({ return; } - var previewContBB = this._partsPreviewCont.getBoundingClientRect(); - var bottomBound; - - if (this._direction === 'x') { - this._previewContTop = previewContBB.left; - bottomBound = previewContBB.right + previewContBB.width / 2; - } else { - this._previewContTop = previewContBB.top; - bottomBound = previewContBB.bottom + previewContBB.height / 2; - } - + var bottomBound = this._getBottomBound(); for (var prev = 0; prev < this._previewTiles.length; prev++) { this._layoutPreview(prev, this._previewTiles[prev], bottomBound); } @@ -242,6 +223,21 @@ L.Control.PartsPreview = L.Control.extend({ return img; }, + _getBottomBound: function () { + var previewContBB = this._partsPreviewCont.getBoundingClientRect(); + var bottomBound; + + if (this._direction === 'x') { + this._previewContTop = previewContBB.left; + bottomBound = previewContBB.right + previewContBB.width / 2; + } else { + this._previewContTop = previewContBB.top; + bottomBound = previewContBB.bottom + previewContBB.height / 2; + } + + return bottomBound; + }, + _layoutPreview: function (i, img, bottomBound) { var topBound = this._previewContTop; var previewFrameTop = 0; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits