Destilled node operations to an operation queue

This commit is contained in:
2020-12-05 03:41:44 +01:00
parent 1428502706
commit 4ff230007c
3 changed files with 164 additions and 31 deletions

View File

@@ -152,7 +152,11 @@ export default {
const existed = this.scene.links.find((link) => {
return link.from === this.draggingLink.from && link.to === index;
})
if (!existed) {
// check for conflicting
const conflicting = this.scene.links.find((link) => { // This makes sure that only one link can go towards a node
return link.to === index;
})
if (!existed && !conflicting) {
let maxID = Math.max(0, ...this.scene.links.map((link) => {
return link.id
}))
@@ -223,10 +227,16 @@ export default {
if (typeof target.className === 'string' && target.className.indexOf('node-delete') > -1) {
// console.log('delete2', this.action.dragging);
this.nodeDelete(this.action.dragging);
this.action.dragging = null;
}
}
if (this.action.dragging) {
this.$emit("nodeMoved", this.action.dragging);
this.action.dragging = null;
}
this.action.linking = false;
this.action.dragging = null;
this.action.scrolling = false;
},
handleDown(e) {