mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-09 01:45:30 +02:00
fix: improve workspace session restoration and scrolling behavior
This commit is contained in:
parent
a6e03680eb
commit
1473675094
5 changed files with 33 additions and 16 deletions
|
@ -405,6 +405,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
|
||||
_handleSwipeMayStart(event) {
|
||||
if (!this.workspaceEnabled) return;
|
||||
if (event.target.closest('#zen-sidebar-bottom-buttons')) return;
|
||||
|
||||
// Only handle horizontal swipes
|
||||
if (event.direction === event.DIRECTION_LEFT || event.direction === event.DIRECTION_RIGHT) {
|
||||
|
@ -648,6 +649,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
if (gZenVerticalTabsManager._canReplaceNewTab && showed) {
|
||||
BrowserCommands.openTab();
|
||||
}
|
||||
gZenViewSplitter.onAfterWorkspaceSessionRestore();
|
||||
}
|
||||
|
||||
handleInitialTab(tab, isEmpty) {
|
||||
|
@ -2415,6 +2417,17 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
|||
const maxWidth = 100 / numButtons;
|
||||
parent.style.setProperty('--zen-overflowed-workspace-button-width', `${maxWidth}%`);
|
||||
this._processingResize = false;
|
||||
|
||||
// Scroll to the active workspace button if it's not visible
|
||||
const activeButton = parent.querySelector('.zen-workspace-button.active');
|
||||
if (!activeButton) {
|
||||
return;
|
||||
}
|
||||
const parentRect = parent.getBoundingClientRect();
|
||||
const activeRect = activeButton.getBoundingClientRect();
|
||||
if (activeRect.left < parentRect.left || activeRect.right > parentRect.right) {
|
||||
parent.scrollLeft = activeButton.offsetLeft;
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue