Fix item pane size when switching to note in stacked mode

This commit is contained in:
windingwind 2024-01-23 16:04:35 +08:00 committed by Dan Stillman
parent f59ee25fd7
commit 7f58873e0b

View file

@ -1973,14 +1973,25 @@ var ZoteroPane = new function()
} }
} }
const sidenavWidth = 37; let isStackedMode = Zotero.Prefs.get("layout") === "stacked";
const sidenavSize = 37;
if (hideSidenav && !sidenav.hidden) { if (hideSidenav && !sidenav.hidden) {
sidenav.hidden = true; sidenav.hidden = true;
pane.width = `${(pane.clientWidth) + sidenavWidth}`; if (isStackedMode) {
pane.height = `${(pane.clientHeight) + sidenavSize}`;
}
else {
pane.width = `${(pane.clientWidth) + sidenavSize}`;
}
} }
else if (!hideSidenav && sidenav.hidden) { else if (!hideSidenav && sidenav.hidden) {
sidenav.hidden = false; sidenav.hidden = false;
pane.width = `${pane.clientWidth - sidenavWidth}`; if (isStackedMode) {
pane.height = `${(pane.clientHeight) - sidenavSize}`;
}
else {
pane.width = `${(pane.clientWidth) - sidenavSize}`;
}
} }
return true; return true;
@ -1993,7 +2004,7 @@ var ZoteroPane = new function()
.finally(function () { .finally(function () {
return this.itemsView.runListeners('select'); return this.itemsView.runListeners('select');
}.bind(this)); }.bind(this));
} };
/** /**