Initial commit to release

This commit is contained in:
Jan Oberhauser
2019-06-23 12:35:23 +02:00
commit 9cb9804eee
257 changed files with 42436 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
import mixins from 'vue-typed-mixins';
import { nodeIndex } from '@/components/mixins/nodeIndex';
export const moveNodeWorkflow = mixins(nodeIndex).extend({
data () {
return {
moveLastPosition: [0, 0],
};
},
mounted () {
},
methods: {
moveWorkflow (e: MouseEvent) {
const offsetPosition = this.$store.getters.getNodeViewOffsetPosition;
const nodeViewOffsetPositionX = offsetPosition[0] + (e.pageX - this.moveLastPosition[0]);
const nodeViewOffsetPositionY = offsetPosition[1] + (e.pageY - this.moveLastPosition[1]);
this.$store.commit('setNodeViewOffsetPosition', [nodeViewOffsetPositionX, nodeViewOffsetPositionY]);
// Update the last position
this.moveLastPosition[0] = e.pageX;
this.moveLastPosition[1] = e.pageY;
},
mouseDownMoveWorkflow (e: MouseEvent) {
if (e.ctrlKey === false) {
// We only care about it when the ctrl key is pressed at the same time.
// So we exit when it is not pressed.
return;
}
if (this.$store.getters.isActionActive('dragActive')) {
// If a node does currently get dragged we do not activate the selection
return;
}
this.$store.commit('setNodeViewMoveInProgress', true);
this.moveLastPosition[0] = e.pageX;
this.moveLastPosition[1] = e.pageY;
// @ts-ignore
this.$el.addEventListener('mousemove', this.mouseMoveNodeWorkflow);
},
mouseUpMoveWorkflow (e: MouseEvent) {
if (this.$store.getters.isNodeViewMoveInProgress === false) {
// If it is not active return direcly.
// Else normal node dragging will not work.
return;
}
// @ts-ignore
this.$el.removeEventListener('mousemove', this.mouseMoveNodeWorkflow);
this.$store.commit('setNodeViewMoveInProgress', false);
// Nothing else to do. Simply leave the node view at the current offset
},
mouseMoveNodeWorkflow (e: MouseEvent) {
if (e.buttons === 0) {
// Mouse button is not pressed anymore so stop selection mode
// Happens normally when mouse leave the view pressed and then
// comes back unpressed.
// @ts-ignore
this.mouseUp(e);
return;
}
this.moveWorkflow(e);
},
},
});