loleaflet/src/control/Control.Tabs.js |   15 +++++++++++++++
 1 file changed, 15 insertions(+)

New commits:
commit 9d412a164e3931b154b0c6d348bb4576609d882a
Author:     Dennis Francis <[email protected]>
AuthorDate: Wed Mar 4 13:38:42 2020 +0530
Commit:     Henry Castro <[email protected]>
CommitDate: Fri Mar 6 13:33:32 2020 +0100

    Remember the horizontal scroll position of calc tab-bar
    
    Whenever the tab-bar contents are updated, restore the last
    known scroll position.
    
    This fixes a very annoying problem while selecting a sheet in
    a document with many many sheets. Everytime the user selects a sheet
    (closer to the last sheet), the tab-bar's scroll position is reset
    to sheet#1, so if the user wants to select another sheet near the
    last sheet, they have to scroll again a lot to see it.
    
    Change-Id: I7e79b6e1a7b19223e1dbd9b3aab6c6f2b4d422b2
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/89946
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Henry Castro <[email protected]>

diff --git a/loleaflet/src/control/Control.Tabs.js 
b/loleaflet/src/control/Control.Tabs.js
index 7d5e12e94..0997d7dd9 100644
--- a/loleaflet/src/control/Control.Tabs.js
+++ b/loleaflet/src/control/Control.Tabs.js
@@ -98,7 +98,16 @@ L.Control.Tabs = L.Control.extend({
                                }, this), 100);
                                this._tabsInitialized = true;
                        }
+
+                       // Save scroll position
+                       var horizScrollPos = 0;
+                       var scrollDiv = L.DomUtil.get('spreadsheet-tab-scroll');
+                       if (scrollDiv) {
+                               horizScrollPos = scrollDiv.scrollLeft;
+                       }
+
                        if ('partNames' in e) {
+
                                while (this._tabsCont.firstChild) {
                                        
this._tabsCont.removeChild(this._tabsCont.firstChild);
                                }
@@ -151,6 +160,12 @@ L.Control.Tabs = L.Control.extend({
                                        
L.DomUtil.addClass(this._spreadsheetTabs[key], 'spreadsheet-tab-selected');
                                }
                        }
+
+                       // Restore horizontal scroll position
+                       scrollDiv = L.DomUtil.get('spreadsheet-tab-scroll');
+                       if (scrollDiv) {
+                               scrollDiv.scrollLeft = horizScrollPos;
+                       }
                }
        },
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to