This commit is contained in:
parent
c074752b89
commit
c09079ecae
@ -67,6 +67,10 @@ export default {
|
|||||||
top: 0,
|
top: 0,
|
||||||
left: 0
|
left: 0
|
||||||
},
|
},
|
||||||
|
dragOrigin: {
|
||||||
|
x: 0,
|
||||||
|
y: 0
|
||||||
|
}
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
@ -184,6 +188,11 @@ export default {
|
|||||||
},
|
},
|
||||||
nodeSelected(id, e) {
|
nodeSelected(id, e) {
|
||||||
this.action.dragging = id;
|
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.action.selected = id;
|
||||||
this.$emit('nodeClick', id);
|
this.$emit('nodeClick', id);
|
||||||
this.mouse.lastX = e.pageX || e.clientX + document.documentElement.scrollLeft
|
this.mouse.lastX = e.pageX || e.clientX + document.documentElement.scrollLeft
|
||||||
@ -231,7 +240,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.action.dragging) {
|
if (this.action.dragging) {
|
||||||
this.$emit("nodeMoved", 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;
|
this.action.dragging = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,7 +264,7 @@ export default {
|
|||||||
moveSelectedNode(dx, dy) {
|
moveSelectedNode(dx, dy) {
|
||||||
let index = this.scene.nodes.findIndex((item) => {
|
let index = this.scene.nodes.findIndex((item) => {
|
||||||
return item.id === this.action.dragging
|
return item.id === this.action.dragging
|
||||||
})
|
});
|
||||||
let left = this.scene.nodes[index].x + dx / this.scene.scale;
|
let left = this.scene.nodes[index].x + dx / this.scene.scale;
|
||||||
let top = this.scene.nodes[index].y + dy / 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], {
|
this.$set(this.scene.nodes, index, Object.assign(this.scene.nodes[index], {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<!-- toolbar -->
|
<!-- toolbar -->
|
||||||
<toolbar @showDrawerClicked="showDrawer = true"
|
<toolbar @showDrawerClicked="showDrawer = true"
|
||||||
@applyClicked="performApply"
|
@applyClicked="performApply"
|
||||||
:processing="anyPendingNodeMoves || processingNodeChanges"
|
:processing="anyPendingNodeMoves || processingNodeChanges || processingModelDownload"
|
||||||
:model-changed="modelChanged"
|
:model-changed="modelChanged"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user