forked from ZenBrowserMirrors/zen-desktop
Add smooth scroll preference for tab startup and adjust visibility logic
This commit is contained in:
parent
32e9d6fe72
commit
d91c9dc41f
3 changed files with 75 additions and 2 deletions
|
@ -181,6 +181,9 @@ pref('zen.splitView.min-resize-width', 7);
|
||||||
pref('zen.splitView.change-on-hover', false);
|
pref('zen.splitView.change-on-hover', false);
|
||||||
pref('zen.splitView.rearrange-hover-size', 24);
|
pref('zen.splitView.rearrange-hover-size', 24);
|
||||||
|
|
||||||
|
// Startup flags
|
||||||
|
pref('zen.startup.smooth-scroll-in-tabs', true);
|
||||||
|
|
||||||
// Zen Workspaces
|
// Zen Workspaces
|
||||||
pref('zen.workspaces.enabled', true);
|
pref('zen.workspaces.enabled', true);
|
||||||
pref('zen.workspaces.hide-deactivated-workspaces', false);
|
pref('zen.workspaces.hide-deactivated-workspaces', false);
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Disable smooth scroll
|
// Disable smooth scroll
|
||||||
gBrowser.tabContainer.arrowScrollbox.smoothScroll = false;
|
gBrowser.tabContainer.arrowScrollbox.smoothScroll = Services.prefs.getBoolPref('zen.startup.smooth-scroll-in-tabs', false);
|
||||||
|
|
||||||
ZenWorkspaces.init();
|
ZenWorkspaces.init();
|
||||||
gZenUIManager.init();
|
gZenUIManager.init();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
diff --git a/browser/components/tabbrowser/content/tabs.js b/browser/components/tabbrowser/content/tabs.js
|
||||||
index f7c39fe804182e2bdf53045ba3b6a5ba17079fc3..93be23da305a5e2e51bff1c5b5f287439a8fafa8 100644
|
index f7c39fe804182e2bdf53045ba3b6a5ba17079fc3..bddba0cb7b475ca7a8d0e58227c62f82b62e118b 100644
|
||||||
--- a/browser/components/tabbrowser/content/tabs.js
|
--- a/browser/components/tabbrowser/content/tabs.js
|
||||||
+++ b/browser/components/tabbrowser/content/tabs.js
|
+++ b/browser/components/tabbrowser/content/tabs.js
|
||||||
@@ -649,7 +649,7 @@
|
@@ -649,7 +649,7 @@
|
||||||
|
@ -158,3 +158,73 @@ index f7c39fe804182e2bdf53045ba3b6a5ba17079fc3..93be23da305a5e2e51bff1c5b5f28743
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2726,12 +2730,14 @@
|
||||||
|
selectedTab = {
|
||||||
|
left: selectedTab.left,
|
||||||
|
right: selectedTab.right,
|
||||||
|
+ top: selectedTab.top,
|
||||||
|
+ bottom: selectedTab.bottom
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return [
|
||||||
|
this._lastTabToScrollIntoView,
|
||||||
|
this.arrowScrollbox.scrollClientRect,
|
||||||
|
- { left: lastTabRect.left, right: lastTabRect.right },
|
||||||
|
+ lastTabRect,
|
||||||
|
selectedTab,
|
||||||
|
];
|
||||||
|
})
|
||||||
|
@@ -2748,8 +2754,13 @@
|
||||||
|
delete this._lastTabToScrollIntoView;
|
||||||
|
// Is the new tab already completely visible?
|
||||||
|
if (
|
||||||
|
- scrollRect.left <= tabRect.left &&
|
||||||
|
- tabRect.right <= scrollRect.right
|
||||||
|
+ this.verticalMode ? (
|
||||||
|
+ scrollRect.top <= tabRect.top &&
|
||||||
|
+ tabRect.bottom <= scrollRect.bottom
|
||||||
|
+ ) : (
|
||||||
|
+ scrollRect.left <= tabRect.left &&
|
||||||
|
+ tabRect.right <= scrollRect.right
|
||||||
|
+ )
|
||||||
|
) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@@ -2758,19 +2769,30 @@
|
||||||
|
// Can we make both the new tab and the selected tab completely visible?
|
||||||
|
if (
|
||||||
|
!selectedRect ||
|
||||||
|
- Math.max(
|
||||||
|
- tabRect.right - selectedRect.left,
|
||||||
|
- selectedRect.right - tabRect.left
|
||||||
|
- ) <= scrollRect.width
|
||||||
|
+ this.verticalMode ? (
|
||||||
|
+ Math.max(
|
||||||
|
+ tabRect.bottom - selectedRect.top,
|
||||||
|
+ selectedRect.bottom - tabRect.top
|
||||||
|
+ ) <= scrollRect.height
|
||||||
|
+ ) : (
|
||||||
|
+ Math.max(
|
||||||
|
+ tabRect.right - selectedRect.left,
|
||||||
|
+ selectedRect.right - tabRect.left
|
||||||
|
+ ) <= scrollRect.width
|
||||||
|
+ )
|
||||||
|
) {
|
||||||
|
this.arrowScrollbox.ensureElementIsVisible(tabToScrollIntoView);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.arrowScrollbox.scrollByPixels(
|
||||||
|
- this.#rtlMode
|
||||||
|
- ? selectedRect.right - scrollRect.right
|
||||||
|
- : selectedRect.left - scrollRect.left
|
||||||
|
+ this.verticalMode ? (
|
||||||
|
+ tabRect.top - selectedRect.top
|
||||||
|
+ ) : (
|
||||||
|
+ this.#rtlMode
|
||||||
|
+ ? selectedRect.right - scrollRect.right
|
||||||
|
+ : selectedRect.left - scrollRect.left
|
||||||
|
+ )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue