Skip to content

Commit

Permalink
feat: cancel add when drag
Browse files Browse the repository at this point in the history
  • Loading branch information
yhanwen committed Jun 13, 2019
1 parent f63acda commit 255a568
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/renderer/components/Dialogs/NodeEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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: '',
Expand Down
6 changes: 5 additions & 1 deletion src/renderer/components/Vis.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</div>
<div class="graph-wrapper">
<div class="vis-container" ref="container"></div>
<div class="tool-box" :class="{show: true}" v-if="toolbox"><tool-box :value="toolBoxAction" @change="toolBoxAction=$event" @action="handleToolBoxAction" :selected="selected" /></div>
<div class="tool-box" :class="{show: true}" v-if="toolbox"><tool-box ref="toolbox" :value="toolBoxAction" @change="toolBoxAction=$event" @action="handleToolBoxAction" :selected="selected" /></div>
<div class="add-ons-pop-tip" :class="{show: hoverNodeItem}">
<div class="wrapper" v-if="hoverNodeItem">
<div class="name">
Expand Down Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions src/renderer/components/Vis/ToolBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export default {
},
},
methods: {
cancelAdd() {
this.$emit('change', '');
},
handleClick(item) {
const { action, disabled } = item;
if (disabled) {
Expand Down

0 comments on commit 255a568

Please sign in to comment.