1
0
Fork 1
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:
mr. m 2025-03-25 19:51:03 +01:00
parent a6e03680eb
commit 1473675094
No known key found for this signature in database
GPG key ID: 419302196C23B258
5 changed files with 33 additions and 16 deletions

View file

@ -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;
}
});
}
})();