Skip to content

Commit

Permalink
feat(ui): enable multiples move in workflow - WF-148
Browse files Browse the repository at this point in the history
  • Loading branch information
madeindjs committed Dec 20, 2024
1 parent 096a811 commit f41923d
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/ui/src/components/workflows/WorkflowsWorkflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,34 @@ function moveNode(ev: MouseEvent) {
const newX = Math.floor(x - offset.x);
const newY = Math.floor(y - offset.y);
const translationX = newX - component.x;
const translationY = newY - component.y;
updateComponentCoordinate(component, newX, newY);
// apply the same vector to other selected components
const otherSelectedComponents = wfbm
.getSelection()
.map((c) => wf.getComponentById(c.componentId))
.filter(
(c) => c.id !== nodeId && c.x !== undefined && c.y !== undefined,
);
for (const selectedComponent of otherSelectedComponents) {
updateComponentCoordinate(
selectedComponent,
selectedComponent.x + translationX,
selectedComponent.y + translationY,
);
}
}
function updateComponentCoordinate(
component: Component,
newX: number,
newY: number,
) {
if (component.x == newX && component.y == newY) return;
component.x = newX;
Expand Down

0 comments on commit f41923d

Please sign in to comment.