events fixed
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pünkösd Marcell 2020-12-06 22:53:05 +01:00
parent c074752b89
commit c09079ecae
2 changed files with 16 additions and 3 deletions

View File

@ -67,6 +67,10 @@ export default {
top: 0,
left: 0
},
dragOrigin: {
x: 0,
y: 0
}
};
},
components: {
@ -184,6 +188,11 @@ export default {
},
nodeSelected(id, e) {
this.action.dragging = id;
const node = this.scene.nodes.find(node => node.id === id);
this.dragOrigin.x = node.x;
this.dragOrigin.y = node.y;
this.action.selected = id;
this.$emit('nodeClick', id);
this.mouse.lastX = e.pageX || e.clientX + document.documentElement.scrollLeft
@ -231,7 +240,11 @@ export default {
}
if (this.action.dragging) {
const node = this.scene.nodes.find(node => node.id === this.action.dragging);
const moved = (this.dragOrigin.x !== node.x) || (this.dragOrigin.y !== node.y)
if (moved) {
this.$emit("nodeMoved", this.action.dragging);
}
this.action.dragging = null;
}
@ -251,7 +264,7 @@ export default {
moveSelectedNode(dx, dy) {
let index = this.scene.nodes.findIndex((item) => {
return item.id === this.action.dragging
})
});
let left = this.scene.nodes[index].x + dx / this.scene.scale;
let top = this.scene.nodes[index].y + dy / this.scene.scale;
this.$set(this.scene.nodes, index, Object.assign(this.scene.nodes[index], {

View File

@ -4,7 +4,7 @@
<!-- toolbar -->
<toolbar @showDrawerClicked="showDrawer = true"
@applyClicked="performApply"
:processing="anyPendingNodeMoves || processingNodeChanges"
:processing="anyPendingNodeMoves || processingNodeChanges || processingModelDownload"
:model-changed="modelChanged"
/>