loleaflet/src/control/Control.Tabs.js    |    8 +++++++-
 loleaflet/src/control/Control.Toolbar.js |    2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 98258da7189fb14f0aae88d5073d64fce71ae764
Author:     Dennis Francis <dennis.fran...@collabora.com>
AuthorDate: Sat Mar 7 17:39:12 2020 +0530
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Mon Mar 16 15:55:30 2020 +0100

    Scroll to last tab when a new sheet is inserted
    
    Before the patch on inserting a new sheet using '+' button
    in a spreadsheet with lots of sheets, the scroll position remains
    unchanged. With this change, it scrolls to the newly inserted tab
    at the end.
    
    Change-Id: Iaa343aac51636043ab4629a847e2315e5076c4ab
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/90159
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Control.Tabs.js 
b/loleaflet/src/control/Control.Tabs.js
index 8c56372da..182a154c0 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -165,7 +165,13 @@ L.Control.Tabs = L.Control.extend({
                        // Restore horizontal scroll position
                        scrollDiv = L.DomUtil.get('spreadsheet-tab-scroll');
                        if (scrollDiv) {
-                               scrollDiv.scrollLeft = horizScrollPos;
+                               if (this._map.insertPage && 
this._map.insertPage.scrollToEnd) {
+                                       this._map.insertPage.scrollToEnd = 
false;
+                                       scrollDiv.scrollLeft = 
scrollDiv.scrollWidth;
+                               }
+                               else {
+                                       scrollDiv.scrollLeft = horizScrollPos;
+                               }
                        }
                }
        },
diff --git a/loleaflet/src/control/Control.Toolbar.js 
b/loleaflet/src/control/Control.Toolbar.js
index a26a63304..9e8d87d8c 100644
--- a/loleaflet/src/control/Control.Toolbar.js
+++ b/loleaflet/src/control/Control.Toolbar.js
@@ -252,7 +252,7 @@ function onClick(e, id, item, subItem) {
        else if (id === 'insertsheet') {
                var nPos = $('#spreadsheet-tab-scroll')[0].childElementCount;
                map.insertPage(nPos);
-               
$('#spreadsheet-tab-scroll').scrollLeft($('#spreadsheet-tab-scroll').prop('scrollWidth'));
+               map.insertPage.scrollToEnd = true;
        }
        else if (id === 'firstrecord') {
                $('#spreadsheet-tab-scroll').scrollLeft(0);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to