From 255a5681e61c39fffa7b2cf03fce31959bdf4727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BF=B0=E6=96=87?= Date: Thu, 13 Jun 2019 14:22:33 +0800 Subject: [PATCH] feat: cancel add when drag --- src/renderer/components/Dialogs/NodeEditor.vue | 2 +- src/renderer/components/Vis.vue | 6 +++++- src/renderer/components/Vis/ToolBox.vue | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/renderer/components/Dialogs/NodeEditor.vue b/src/renderer/components/Dialogs/NodeEditor.vue index 8e3e025..39ba69b 100644 --- a/src/renderer/components/Dialogs/NodeEditor.vue +++ b/src/renderer/components/Dialogs/NodeEditor.vue @@ -142,7 +142,7 @@ export default { editNode(node, callback) { this.dialogVisible = true; this.callback = callback; - this.labels = node.labels.slice(0); + this.labels = node.labels ? node.labels.slice(0) : []; this.$set(this, 'form', Object.assign({ labels: [], label: '', diff --git a/src/renderer/components/Vis.vue b/src/renderer/components/Vis.vue index deace84..64025c9 100644 --- a/src/renderer/components/Vis.vue +++ b/src/renderer/components/Vis.vue @@ -32,7 +32,7 @@
-
+
@@ -385,6 +385,10 @@ export default { }); }); this.dragging = true; + if (this.$refs.toolbox) { + this.networkInst.disableEditMode(); + this.$refs.toolbox.cancelAdd(); + } }); this.networkInst.on('dragEnd', (event) => { const { diff --git a/src/renderer/components/Vis/ToolBox.vue b/src/renderer/components/Vis/ToolBox.vue index 7d25508..9be7659 100644 --- a/src/renderer/components/Vis/ToolBox.vue +++ b/src/renderer/components/Vis/ToolBox.vue @@ -80,6 +80,9 @@ export default { }, }, methods: { + cancelAdd() { + this.$emit('change', ''); + }, handleClick(item) { const { action, disabled } = item; if (disabled) {