[Libreoffice-commits] online.git: loleaflet/src

Dennis Francis (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 6 13:15:30 UTC 2020


 loleaflet/src/control/Control.Toolbar.js |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 824f48c447ff2af8814a5ae28bb58ce820357430
Author:     Dennis Francis <dennis.francis at collabora.com>
AuthorDate: Wed Mar 4 14:57:23 2020 +0530
Commit:     Henry Castro <hcastro at collabora.com>
CommitDate: Fri Mar 6 14:15:10 2020 +0100

    On clicking last-sheet button, scroll to last tab
    
    Before this patch, it used to scroll a fixed 120 px and does not
    guarantee the visibility of the last tab especially if there are
    lots of sheets in the document.
    
    For scrolling to last tab, just use native scrollLeft attribute
    rather than relying on jquery. On setting native scrollLeft to a
    very high value, it ensures that it scrolls to the maximum possible
    level (and shows the last tab) according to MDN scrollLeft documentation.
    
    https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
    
    Sadly jquery documentation for its scrollLeft() does not mention
    anything about the behaviour on setting a very high value(more than
    maximum scroll), even though it appears to work.
    
    Change-Id: I05142c1d3d63551fa2dc8359e41e30edc78a7d09
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89948
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Henry Castro <hcastro at collabora.com>

diff --git a/loleaflet/src/control/Control.Toolbar.js b/loleaflet/src/control/Control.Toolbar.js
index 95c36dedd..5bd13e147 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -265,7 +265,9 @@ function onClick(e, id, item, subItem) {
 		$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').scrollLeft() - 30);
 	}
 	else if (id === 'lastrecord') {
-		$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').scrollLeft() + 120);
+		// Set a very high value, so that scroll is set to the maximum possible value internally.
+		// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft
+		L.DomUtil.get('spreadsheet-tab-scroll').scrollLeft = 100000;
 	}
 	else if (id === 'insertgraphic' || item.id === 'localgraphic') {
 		L.DomUtil.get('insertgraphic').click();


More information about the Libreoffice-commits mailing list