An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:lipstick: Improve mind map floating toolbar appearance https://github.com/siyuan-note/siyuan/issues/20032
Daniele93c1ddae701
diff --git a/app/src/assets/scss/protyle/_mindmap-view.scss b/app/src/assets/scss/protyle/_mindmap-view.scssindex 52f1e10780..5e5cd62dcd 100644--- a/app/src/assets/scss/protyle/_mindmap-view.scss+++ b/app/src/assets/scss/protyle/_mindmap-view.scss@@ -753,7 +753,7 @@&__route-status {position: absolute;- bottom: 40px;+ bottom: 72px;left: 50%;z-index: 6;transform: translateX(-50%);@@ -767,12 +767,12 @@}&__inspector {- @include protyle-toolbar-surface;+ @include protyle-toolbar-surface($shadow: 0 0 0 1px var(--b3-border-color));position: absolute;left: 50%;right: auto;transform: translateX(-50%);- bottom: 0;+ bottom: 8px;z-index: 6;width: max-content;min-width: 0;diff --git a/app/src/assets/scss/util/_mixin.scss b/app/src/assets/scss/util/_mixin.scssindex 291a80634e..a951c0a66f 100644--- a/app/src/assets/scss/util/_mixin.scss+++ b/app/src/assets/scss/util/_mixin.scss@@ -18,9 +18,9 @@color: var(--b3-theme-on-background);}-@mixin protyle-toolbar-surface {+@mixin protyle-toolbar-surface($shadow: var(--b3-dialog-shadow)) {background-color: var(--b3-theme-background);- box-shadow: var(--b3-dialog-shadow);+ box-shadow: $shadow;border-radius: var(--b3-border-radius);display: flex;}diff --git a/app/src/protyle/render/listMindmap/model.test.ts b/app/src/protyle/render/listMindmap/model.test.tsindex 767e95ea23..8f36902288 100644--- a/app/src/protyle/render/listMindmap/model.test.ts+++ b/app/src/protyle/render/listMindmap/model.test.ts@@ -1267,12 +1267,19 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,select(beta);check.equal(inspector.hidden, false);check.equal(inspector.classList.contains("mindmap-view__inspector--node"), true);- check.equal(getComputedStyle(inspector).bottom, "0px");+ check.equal(getComputedStyle(inspector).bottom, "8px");check.equal(host.querySelector(".mindmap-view__status"), null);const nodeMenuBounds = inspector.getBoundingClientRect();const panelBounds = host.getBoundingClientRect();check.ok(Math.abs(nodeMenuBounds.left + nodeMenuBounds.width / 2 - panelBounds.left - panelBounds.width / 2) < 2);check.ok(nodeMenuBounds.width < panelBounds.width / 2);+ check.ok(panelBounds.bottom - nodeMenuBounds.bottom >= 8);+ for (const borderColor of ["#d4d4d4", "#484848"]) {+ host.style.setProperty("--b3-border-color", borderColor);+ check.equal(getComputedStyle(inspector).boxShadow,+ getComputedStyle(host).borderTopColor + " 0px 0px 0px 1px");+ }+ host.style.removeProperty("--b3-border-color");check.equal(inspector.querySelectorAll('input[type="number"]').length, 0);check.equal(inspector.querySelectorAll('input[type="checkbox"]').length, 0);check.equal(inspector.querySelector('input[type="color"]'), null);@@ -1516,10 +1523,25 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(relationElement.classList.contains("mindmap-view__relation--hover"), false);check.equal(inspector.hidden, false);check.equal(inspector.classList.contains("mindmap-view__inspector--line"), true);- check.equal(getComputedStyle(inspector).bottom, "0px");+ check.equal(getComputedStyle(inspector).bottom, "8px");const lineMenuBounds = inspector.getBoundingClientRect();check.ok(Math.abs(lineMenuBounds.left + lineMenuBounds.width / 2 - panelBounds.left - panelBounds.width / 2) < 2);check.ok(lineMenuBounds.width < panelBounds.width / 2);+ const routeStatus = host.querySelector<HTMLElement>(".mindmap-view__route-status");+ const statusHidden = routeStatus.hidden;+ routeStatus.hidden = false;+ check.ok(routeStatus.getBoundingClientRect().bottom < lineMenuBounds.top);+ routeStatus.hidden = statusHidden;+ hostParent.style.width = "320px";+ const narrowInspectorBounds = inspector.getBoundingClientRect();+ const narrowPanelBounds = host.getBoundingClientRect();+ check.ok(narrowInspectorBounds.left > narrowPanelBounds.left);+ check.ok(narrowInspectorBounds.right < narrowPanelBounds.right);+ check.ok(inspector.scrollWidth > inspector.clientWidth);+ inspector.scrollLeft = inspector.scrollWidth;+ check.ok(inspector.scrollLeft > 0);+ inspector.scrollLeft = 0;+ hostParent.style.width = "760px";check.equal(inspector.querySelector(".mindmap-view__section"), null);const arrowSelector = () => inspector.querySelector<HTMLSelectElement>('[aria-label="listMindmapArrowDirection"]');check.ok(arrowSelector().classList.contains("b3-select"));@@ -2028,6 +2050,9 @@ const browserCases = async (sourceCode: string, css: string, taskSource: string,check.equal(host.getBoundingClientRect().left, 0);check.equal(host.getBoundingClientRect().width, window.innerWidth);check.equal(getComputedStyle(host).zIndex, "8");+ select(beta);+ check.equal(inspector.hidden, false);+ check.ok(host.getBoundingClientRect().bottom - inspector.getBoundingClientRect().bottom >= 8);check.deepEqual(fullscreenChanges, [true]);view.setReadOnly(true);check.ok(host.querySelector('[aria-label="exitFullscreen"]'));diff --git a/app/src/protyle/render/listMindmap/view.ts b/app/src/protyle/render/listMindmap/view.tsindex 2372a582bb..0cd627e07a 100644--- a/app/src/protyle/render/listMindmap/view.ts+++ b/app/src/protyle/render/listMindmap/view.ts@@ -2601,8 +2601,8 @@ export class ListMindmapView {this.draw();const {left, top, right, bottom} = this.contentBounds();const insetTop = 16;- // 菜单打开前后保持相同的底部留白,避免选中节点时画布跳动。- const insetBottom = 42;+ // 底部为菜单、外侧间距和横向滚动条留出空间,避免选中节点时画布跳动。+ const insetBottom = 66;const availableWidth = Math.max(1, width - 48);const availableHeight = Math.max(1, height - insetTop - insetBottom);this.scale = Math.min(maxScale, Math.max(.15, Math.min(availableWidth / Math.max(1, right - left),