[Libreoffice-commits] online.git: Branch 'distro/collabora/co-4-2' - loleaflet/src

Henry Castro (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 11 19:45:23 UTC 2020


 loleaflet/src/control/Control.PartsPreview.js |   38 +++++++++++---------------
 1 file changed, 17 insertions(+), 21 deletions(-)

New commits:
commit 7bf6c0604376bb0f1a33fdcc81e67ccf9b84c6f6
Author:     Henry Castro <hcastro at collabora.com>
AuthorDate: Thu Jul 2 15:13:12 2020 -0400
Commit:     Henry Castro <hcastro at 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 <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Henry Castro <hcastro at 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;


More information about the Libreoffice-commits mailing list