Fix stacked mode layout when toggle item pane

This commit is contained in:
windingwind 2024-01-23 16:57:16 +08:00 committed by Dan Stillman
parent 8aa77fd5c8
commit 3bdcf34a89
3 changed files with 39 additions and 23 deletions

View file

@ -1973,24 +1973,26 @@ var ZoteroPane = new function()
}
}
let isStackedMode = Zotero.Prefs.get("layout") === "stacked";
const sidenavSize = 37;
if (hideSidenav && !sidenav.hidden) {
sidenav.hidden = true;
if (isStackedMode) {
pane.height = `${(pane.clientHeight) + sidenavSize}`;
if (!document.querySelector("#zotero-items-splitter").collapsed) {
let isStackedMode = Zotero.Prefs.get("layout") === "stacked";
const sidenavSize = 37;
if (hideSidenav && !sidenav.hidden) {
sidenav.hidden = true;
if (isStackedMode) {
pane.height = `${(pane.clientHeight) + sidenavSize}`;
}
else {
pane.width = `${(pane.clientWidth) + sidenavSize}`;
}
}
else {
pane.width = `${(pane.clientWidth) + sidenavSize}`;
}
}
else if (!hideSidenav && sidenav.hidden) {
sidenav.hidden = false;
if (isStackedMode) {
pane.height = `${(pane.clientHeight) - sidenavSize}`;
}
else {
pane.width = `${(pane.clientWidth) - sidenavSize}`;
else if (!hideSidenav && sidenav.hidden) {
sidenav.hidden = false;
if (isStackedMode) {
pane.height = `${(pane.clientHeight) - sidenavSize}`;
}
else {
pane.width = `${(pane.clientWidth) - sidenavSize}`;
}
}
}

View file

@ -186,6 +186,8 @@
{
width: 342px;
min-width: 342px;
/* Need a min height to prevent layout issues in stacked mode */
min-height: 168px;
}
#zotero-layout-switcher

View file

@ -69,11 +69,23 @@ splitter {
}
#zotero-items-splitter,
#zotero-context-splitter {
@include splitter-invisible-size(right);
&[state="collapsed"] {
--draggable-size: 1px;
border: 0;
margin-left: -1px;
#zotero-context-splitter,
#zotero-context-splitter-stacked {
&[orient=vertical] {
&[state="collapsed"] {
margin-bottom: -1px;
--draggable-size: 1px;
border: 0;
}
}
&:not([orient=vertical]) {
@include splitter-invisible-size(right);
&[state="collapsed"] {
margin-right: -1px;
--draggable-size: 1px;
border: 0;
}
}
}