From 194571d5fe04c1504c207e588cec037630007fb9 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, 25 Jul 2024 18:05:22 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E5=9C=A8@svgdotj?= =?UTF-8?q?s/svg.js=E5=BA=93=E7=89=88=E6=9C=AC=E4=B8=BA3.0.16=E6=97=B6?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 2 +- simple-mind-map/src/core/render/node/nodeExpandBtn.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index 417c46aa..5e7a55d6 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -528,6 +528,7 @@ class Node { textContentNested.add(foreignObject) textContentOffsetX += this._postfixData.width } + this.group.add(textContentNested) // 文字内容整体 textContentNested.translate( width / 2 - textContentNested.bbox().width / 2, @@ -535,7 +536,6 @@ class Node { imgHeight + // 图片高度 (imgHeight > 0 && textContentHeight > 0 ? this.blockContentMargin : 0) // 和图片的间距 ) - this.group.add(textContentNested) addHoverNode() this.mindMap.emit('node_layout_end', this) } diff --git a/simple-mind-map/src/core/render/node/nodeExpandBtn.js b/simple-mind-map/src/core/render/node/nodeExpandBtn.js index 931a252f..16001d15 100644 --- a/simple-mind-map/src/core/render/node/nodeExpandBtn.js +++ b/simple-mind-map/src/core/render/node/nodeExpandBtn.js @@ -1,5 +1,5 @@ import btnsSvg from '../../../svg/btns' -import { SVG, Circle, G } from '@svgdotjs/svg.js' +import { SVG, Circle, G, Text } from '@svgdotjs/svg.js' // 创建展开收起按钮的内容节点 function createExpandNodeContent() { @@ -10,7 +10,7 @@ function createExpandNodeContent() { // 根据配置判断是否显示数量按钮 if (this.mindMap.opt.isShowExpandNum) { // 展开的节点 - this._openExpandNode = SVG().text() + this._openExpandNode = new Text() // 文本垂直居中 this._openExpandNode.attr({ 'text-anchor': 'middle', @@ -79,7 +79,7 @@ function updateExpandBtnNode() { // 计算子节点数量 let count = this.sumNode(this.nodeData.children) count = expandBtnNumHandler(count) - node.text(count) + node.text(String(count)) } else { this._fillExpandNode.stroke('none') }