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') }