From 79a39f993d6714c0b3ebb6528564ff2f28cc9338 Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Mon, 4 Dec 2023 09:51:56 +0800 Subject: [PATCH] =?UTF-8?q?Fix=EF=BC=9A=E4=BF=AE=E5=A4=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E8=8A=82=E7=82=B9=E4=B9=9F=E4=BC=9A=E8=A7=A6=E5=8F=91?= =?UTF-8?q?node=5Fdragend=E4=BA=8B=E4=BB=B6=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/plugins/Drag.js | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/simple-mind-map/src/plugins/Drag.js b/simple-mind-map/src/plugins/Drag.js index 9640f501..f633c0b4 100644 --- a/simple-mind-map/src/plugins/Drag.js +++ b/simple-mind-map/src/plugins/Drag.js @@ -1,4 +1,9 @@ -import { bfsWalk, throttle, getTopAncestorsFomNodeList, getNodeIndexInNodeList } from '../utils' +import { + bfsWalk, + throttle, + getTopAncestorsFomNodeList, + getNodeIndexInNodeList +} from '../utils' import Base from '../layouts/Base' // 节点拖动插件 @@ -108,9 +113,7 @@ class Drag extends Base { node.endDrag() }) this.removeCloneNode() - let overlapNodeUid = this.overlapNode - ? this.overlapNode.getData('uid') - : '' + let overlapNodeUid = this.overlapNode ? this.overlapNode.getData('uid') : '' let prevNodeUid = this.prevNode ? this.prevNode.getData('uid') : '' let nextNodeUid = this.nextNode ? this.nextNode.getData('uid') : '' // 存在重叠子节点,则移动作为其子节点 @@ -162,12 +165,14 @@ class Drag extends Base { ) this.mindMap.render() } + if (this.isDragging) { + this.mindMap.emit('node_dragend', { + overlapNodeUid, + prevNodeUid, + nextNodeUid + }) + } this.reset() - this.mindMap.emit('node_dragend', { - overlapNodeUid, - prevNodeUid, - nextNodeUid - }) } // 拖动中