mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
✨ Make it possible to move workflow with mouse-wheel/two-finger
This commit is contained in:
parent
d00610e629
commit
4bbc7edad2
|
@ -83,5 +83,11 @@ export const moveNodeWorkflow = mixins(nodeIndex).extend({
|
||||||
|
|
||||||
this.moveWorkflow(e);
|
this.moveWorkflow(e);
|
||||||
},
|
},
|
||||||
|
wheelMoveWorkflow (e: WheelEvent) {
|
||||||
|
const offsetPosition = this.$store.getters.getNodeViewOffsetPosition;
|
||||||
|
const nodeViewOffsetPositionX = offsetPosition[0] - e.deltaX;
|
||||||
|
const nodeViewOffsetPositionY = offsetPosition[1] - e.deltaY;
|
||||||
|
this.$store.commit('setNodeViewOffsetPosition', [nodeViewOffsetPositionX, nodeViewOffsetPositionY]);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
:class="workflowClasses"
|
:class="workflowClasses"
|
||||||
@mousedown="mouseDown"
|
@mousedown="mouseDown"
|
||||||
@mouseup="mouseUp"
|
@mouseup="mouseUp"
|
||||||
|
@wheel="wheelScroll"
|
||||||
>
|
>
|
||||||
<div class="node-view-background" :style="backgroundStyle"></div>
|
<div class="node-view-background" :style="backgroundStyle"></div>
|
||||||
<div id="node-view" class="node-view" :style="workflowStyle">
|
<div id="node-view" class="node-view" :style="workflowStyle">
|
||||||
|
@ -339,6 +340,9 @@ export default mixins(
|
||||||
this.mouseUpMouseSelect(e);
|
this.mouseUpMouseSelect(e);
|
||||||
this.mouseUpMoveWorkflow(e);
|
this.mouseUpMoveWorkflow(e);
|
||||||
},
|
},
|
||||||
|
wheelScroll (e: WheelEvent) {
|
||||||
|
this.wheelMoveWorkflow(e);
|
||||||
|
},
|
||||||
keyUp (e: KeyboardEvent) {
|
keyUp (e: KeyboardEvent) {
|
||||||
if (e.key === this.controlKeyCode) {
|
if (e.key === this.controlKeyCode) {
|
||||||
this.ctrlKeyPressed = false;
|
this.ctrlKeyPressed = false;
|
||||||
|
|
Loading…
Reference in a new issue