Vanessa 2025-10-23 18:10:55 +08:00
parent bb8b307c2e
commit 929a516e1e
2 changed files with 5 additions and 9 deletions

View file

@ -9,7 +9,7 @@ import {Bookmark} from "./Bookmark";
import {Tag} from "./Tag"; import {Tag} from "./Tag";
import {Graph} from "./Graph"; import {Graph} from "./Graph";
import {Model} from "../Model"; import {Model} from "../Model";
import {saveLayout, setPanelFocus} from "../util"; import {adjustLayout, saveLayout, setPanelFocus} from "../util";
import {getDockByType, resizeTabs} from "../tabUtil"; import {getDockByType, resizeTabs} from "../tabUtil";
import {Inbox} from "./Inbox"; import {Inbox} from "./Inbox";
import {Protyle} from "../../protyle"; import {Protyle} from "../../protyle";
@ -707,7 +707,8 @@ export class Dock {
this.layout.element.style.opacity = ""; this.layout.element.style.opacity = "";
this.hideResizeTimeout = window.setTimeout(() => { this.hideResizeTimeout = window.setTimeout(() => {
this.resizeElement.classList.remove("fn__none"); this.resizeElement.classList.remove("fn__none");
}, 200); // 需等待动画完毕后再出现,否则会出现滚动条 https://ld246.com/article/1676596622064 adjustLayout();
}, Constants.TIMEOUT_TRANSITION); // 需等待动画完毕后再出现,否则会出现滚动条 https://ld246.com/article/1676596622064
} }
if (document.activeElement) { if (document.activeElement) {
(document.activeElement as HTMLElement).blur(); (document.activeElement as HTMLElement).blur();

View file

@ -986,15 +986,13 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
item.element.style.minWidth = ""; item.element.style.minWidth = "";
} }
}); });
let lastItem: HTMLElement; if (layout.direction === "lr" && layout.element.scrollWidth > layout.element.clientWidth + 2 ) {
let index = Math.ceil(screen.width / 8); let index = Math.ceil(screen.width / 8);
if (layout.direction === "lr") {
while (index > 0) { while (index > 0) {
let width = 0; let width = 0;
layout.children.find((item: Layout | Wnd) => { layout.children.find((item: Layout | Wnd) => {
if (item.element.style.width && item.element.style.width !== "0px") { if (item.element.style.width && item.element.style.width !== "0px") {
item.element.style.maxWidth = Math.max(Math.min(item.element.clientWidth, window.innerWidth) - 8, 64) + "px"; item.element.style.maxWidth = Math.max(Math.min(item.element.clientWidth, window.innerWidth) - 8, 64) + "px";
lastItem = item.element;
} }
width += item.element.clientWidth; width += item.element.clientWidth;
}); });
@ -1004,9 +1002,6 @@ export const adjustLayout = (layout: Layout = window.siyuan.layout.centerLayout.
} }
} }
} }
if (lastItem) {
lastItem.style.maxWidth = Math.max(Math.min(lastItem.clientWidth, window.innerWidth) - 8, 64) + "px";
}
layout.children.forEach((item: Layout | Wnd) => { layout.children.forEach((item: Layout | Wnd) => {
if (item instanceof Layout && item.size !== "0px") { if (item instanceof Layout && item.size !== "0px") {
adjustLayout(item); adjustLayout(item);