Fixed nodes always being draggable
This commit is contained in:
parent
0e139785a5
commit
0dc1af27b5
2 changed files with 10 additions and 3 deletions
|
@ -149,8 +149,10 @@ export default defineComponent({
|
|||
e.stopPropagation();
|
||||
|
||||
const zoom = (this.getZoomLevel as () => number)();
|
||||
this.dragged.x += (e.clientX - this.lastMousePosition.x) / zoom;
|
||||
this.dragged.y += (e.clientY - this.lastMousePosition.y) / zoom;
|
||||
this.dragged = {
|
||||
x: this.dragged.x + (e.clientX - this.lastMousePosition.x) / zoom,
|
||||
y: this.dragged.y + (e.clientY - this.lastMousePosition.y) / zoom
|
||||
}
|
||||
this.lastMousePosition = {
|
||||
x: e.clientX,
|
||||
y: e.clientY
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
:transform="`translate(${position.x},${position.y})`"
|
||||
@mouseenter="mouseEnter"
|
||||
@mouseleave="mouseLeave"
|
||||
@mousedown="e => $emit('startDragging', e, node.id)"
|
||||
@mousedown="mouseDown"
|
||||
>
|
||||
<g v-if="shape === Shape.Circle">
|
||||
<circle
|
||||
|
@ -197,6 +197,11 @@ export default defineComponent({
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
mouseDown(e: MouseEvent) {
|
||||
if (this.draggable) {
|
||||
this.$emit('startDragging', e, this.node.id);
|
||||
}
|
||||
},
|
||||
mouseEnter() {
|
||||
this.hovering = true;
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue