From cf87333910284043c1bde02d1fe153c1a9e35354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Wed, 24 Jan 2024 18:51:39 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E7=9B=B4=E8=BF=9E=E9=A3=8E?= =?UTF-8?q?=E6=A0=BC=E6=A0=B9=E8=8A=82=E7=82=B9=E7=9A=84=E8=BF=9E=E7=BA=BF?= =?UTF-8?q?=E8=B5=B7=E7=82=B9=E7=BB=9F=E4=B8=80=E4=B8=BA=E8=8A=82=E7=82=B9?= =?UTF-8?q?=E7=9A=84=E8=BE=B9=E7=95=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/layouts/LogicalStructure.js | 8 +++++--- simple-mind-map/src/layouts/MindMap.js | 9 +++++---- simple-mind-map/src/layouts/OrganizationStructure.js | 3 ++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/simple-mind-map/src/layouts/LogicalStructure.js b/simple-mind-map/src/layouts/LogicalStructure.js index fccb4e23..26c6115c 100644 --- a/simple-mind-map/src/layouts/LogicalStructure.js +++ b/simple-mind-map/src/layouts/LogicalStructure.js @@ -197,10 +197,12 @@ class LogicalStructure extends Base { if (!this.mindMap.opt.alwaysShowExpandBtn) { expandBtnSize = 0 } - let nodeUseLineStyle = this.mindMap.themeConfig.nodeUseLineStyle + const { nodeUseLineStyle } = this.mindMap.themeConfig node.children.forEach((item, index) => { - let x1 = - node.layerIndex === 0 ? left + width / 2 : left + width + expandBtnSize + if (node.layerIndex === 0) { + expandBtnSize = 0 + } + let x1 = left + width + expandBtnSize let y1 = top + height / 2 let x2 = item.left let y2 = item.top + item.height / 2 diff --git a/simple-mind-map/src/layouts/MindMap.js b/simple-mind-map/src/layouts/MindMap.js index b7ce0968..8f616bc1 100644 --- a/simple-mind-map/src/layouts/MindMap.js +++ b/simple-mind-map/src/layouts/MindMap.js @@ -259,12 +259,13 @@ class MindMap extends Base { if (!this.mindMap.opt.alwaysShowExpandBtn) { expandBtnSize = 0 } - let nodeUseLineStyle = this.mindMap.themeConfig.nodeUseLineStyle + const { nodeUseLineStyle } = this.mindMap.themeConfig node.children.forEach((item, index) => { + if (node.layerIndex === 0) { + expandBtnSize = 0 + } let x1 = - node.layerIndex === 0 - ? left + width / 2 - : item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT + item.dir === CONSTANTS.LAYOUT_GROW_DIR.LEFT ? left - expandBtnSize : left + width + expandBtnSize let y1 = top + height / 2 diff --git a/simple-mind-map/src/layouts/OrganizationStructure.js b/simple-mind-map/src/layouts/OrganizationStructure.js index f30ef57a..bc8bb12b 100644 --- a/simple-mind-map/src/layouts/OrganizationStructure.js +++ b/simple-mind-map/src/layouts/OrganizationStructure.js @@ -161,13 +161,14 @@ class OrganizationStructure extends Base { return [] } let { left, top, width, height } = node + const { nodeUseLineStyle } = this.mindMap.themeConfig let x1 = left + width / 2 let y1 = top + height node.children.forEach((item, index) => { let x2 = item.left + item.width / 2 let y2 = item.top // 节点使用横线风格,需要额外渲染横线 - let nodeUseLineStylePath = this.mindMap.themeConfig.nodeUseLineStyle + let nodeUseLineStylePath = nodeUseLineStyle ? ` L ${item.left},${y2} L ${item.left + item.width},${y2}` : '' let path = `M ${x1},${y1} L ${x2},${y2}` + nodeUseLineStylePath