From 5a0b9fbe50ea0e5e474976d0753777d435d709d1 Mon Sep 17 00:00:00 2001 From: "Ivan Hrynevytskyi (FE-underwriting)" <83350900+im-ihrynevytskyi@users.noreply.github.com> Date: Tue, 14 Jun 2022 22:10:39 +0300 Subject: [PATCH] fixed incorrect positioning on zoom or graph move (#3129) Fixes #2972 Co-authored-by: Ivan Hrynevytskyi --- .../src/components/activities/flowchart/flowchart.tsx | 3 ++- .../workflow-definition-editor/workflow-definition-editor.tsx | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/designer/elsa-workflows-designer/src/components/activities/flowchart/flowchart.tsx b/src/designer/elsa-workflows-designer/src/components/activities/flowchart/flowchart.tsx index 17add1cba..a4bbe473f 100644 --- a/src/designer/elsa-workflows-designer/src/components/activities/flowchart/flowchart.tsx +++ b/src/designer/elsa-workflows-designer/src/components/activities/flowchart/flowchart.tsx @@ -74,7 +74,8 @@ export class FlowchartComponent implements ContainerActivityComponent { // TODO: Figure out how to convert client coordinates to appropriate graph coordinates taking into account transformations. // See https://x6.antv.vision/en/docs/api/graph/coordinate for documentation. //const point = graph.coord.localToClientPoint(x, y); - const point: PointLike = {x, y}; + const pageToLocal = graph.pageToLocal(x, y); + const point: PointLike = pageToLocal; const sx = point.x; const sy = point.y; diff --git a/src/designer/elsa-workflows-designer/src/components/designer/workflow-definition-editor/workflow-definition-editor.tsx b/src/designer/elsa-workflows-designer/src/components/designer/workflow-definition-editor/workflow-definition-editor.tsx index 5f2cecc40..a7633149a 100644 --- a/src/designer/elsa-workflows-designer/src/components/designer/workflow-definition-editor/workflow-definition-editor.tsx +++ b/src/designer/elsa-workflows-designer/src/components/designer/workflow-definition-editor/workflow-definition-editor.tsx @@ -271,8 +271,8 @@ export class WorkflowDefinitionEditor { await this.canvas.addActivity({ descriptor: activityDescriptor, id: newName, - x: e.offsetX, - y: e.offsetY + x: e.pageX, + y: e.pageY }); };