From 86c84cba0be064c6e00c40c67c3db5d2145362d1 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: Thu, 13 Feb 2025 09:22:28 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E6=96=B0=E5=A2=9E=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E8=BF=9E=E7=BA=BF=E6=A0=B7=E5=BC=8F=E6=98=AF=E5=90=A6?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E7=BB=A7=E6=89=BF=E7=A5=96=E5=85=88=E7=9A=84?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E7=9A=84=E5=AE=9E=E4=BE=8B=E5=8C=96=E9=80=89?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/constants/defaultOptions.js | 2 ++ .../src/core/render/node/MindMapNode.js | 16 +++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/simple-mind-map/src/constants/defaultOptions.js b/simple-mind-map/src/constants/defaultOptions.js index d93fd734..16289171 100644 --- a/simple-mind-map/src/constants/defaultOptions.js +++ b/simple-mind-map/src/constants/defaultOptions.js @@ -321,6 +321,8 @@ export const defaultOpt = { } */ addCustomContentToNode: null, + // 节点连线样式是否允许继承祖先的连线样式 + enableInheritAncestorLineStyle: false, // 【Select插件】 // 多选节点时鼠标移动到边缘时的画布移动偏移量 diff --git a/simple-mind-map/src/core/render/node/MindMapNode.js b/simple-mind-map/src/core/render/node/MindMapNode.js index 86dd9e5b..34148a8a 100644 --- a/simple-mind-map/src/core/render/node/MindMapNode.js +++ b/simple-mind-map/src/core/render/node/MindMapNode.js @@ -296,7 +296,10 @@ class MindMapNode { typeof addCustomContentToNode.create === 'function' ) { this._customContentAddToNodeAdd = addCustomContentToNode.create(this) - if (this._customContentAddToNodeAdd && this._customContentAddToNodeAdd.el) { + if ( + this._customContentAddToNodeAdd && + this._customContentAddToNodeAdd.el + ) { addXmlns(this._customContentAddToNodeAdd.el) } } @@ -883,15 +886,18 @@ class MindMapNode { // 设置连线样式 styleLine(line, childNode, enableMarker) { + const { enableInheritAncestorLineStyle } = this.mindMap.opt + const getName = enableInheritAncestorLineStyle + ? 'getSelfInhertStyle' + : 'getSelfStyle' const width = - childNode.getSelfInhertStyle('lineWidth') || - childNode.getStyle('lineWidth', true) + childNode[getName]('lineWidth') || childNode.getStyle('lineWidth', true) const color = - childNode.getSelfInhertStyle('lineColor') || + childNode[getName]('lineColor') || this.getRainbowLineColor(childNode) || childNode.getStyle('lineColor', true) const dasharray = - childNode.getSelfInhertStyle('lineDasharray') || + childNode[getName]('lineDasharray') || childNode.getStyle('lineDasharray', true) this.style.line( line,