From dc8efbe3ef86907bd003136193688d2fc6b81bc0 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 9 Aug 2023 09:08:45 +0800 Subject: [PATCH] =?UTF-8?q?Feat=EF=BC=9A=E5=8E=BB=E6=8E=89=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E6=B8=B2=E6=9F=93=E8=8A=82=E7=82=B9=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- simple-mind-map/src/core/render/node/Node.js | 47 +++++++------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/simple-mind-map/src/core/render/node/Node.js b/simple-mind-map/src/core/render/node/Node.js index 9c0c8910..7e15fac6 100644 --- a/simple-mind-map/src/core/render/node/Node.js +++ b/simple-mind-map/src/core/render/node/Node.js @@ -1,6 +1,5 @@ import Style from './Style' import Shape from './Shape' -import { asyncRun, nodeToHTML } from '../../../utils' import { G, Rect, ForeignObject, SVG } from '@svgdotjs/svg.js' import nodeGeneralizationMethods from './nodeGeneralization' import nodeExpandBtnMethods from './nodeExpandBtn' @@ -559,18 +558,14 @@ class Node { this.nodeData.data.expand !== false ) { let index = 0 - asyncRun( - this.children.map(item => { - return () => { - item.render(() => { - index++ - if (index >= this.children.length) { - callback() - } - }) + this.children.forEach(item => { + item.render(() => { + index++ + if (index >= this.children.length) { + callback() } }) - ) + }) } else { callback() } @@ -592,13 +587,9 @@ class Node { this.removeLine() // 子节点 if (this.children && this.children.length) { - asyncRun( - this.children.map(item => { - return () => { - item.remove() - } - }) - ) + this.children.forEach(item => { + item.remove() + }) } } @@ -624,13 +615,9 @@ class Node { } // 子节点 if (this.children && this.children.length) { - asyncRun( - this.children.map(item => { - return () => { - item.hide() - } - }) - ) + this.children.forEach(item => { + item.hide() + }) } } @@ -650,13 +637,9 @@ class Node { } // 子节点 if (this.children && this.children.length) { - asyncRun( - this.children.map(item => { - return () => { - item.show() - } - }) - ) + this.children.forEach(item => { + item.show() + }) } }