fixed incorrect positioning on zoom or graph move (#3129)

Fixes #2972

Co-authored-by: Ivan Hrynevytskyi <ivan.hrynevytskyi@IHRYNEVYTSKYIL.local>
This commit is contained in:
Ivan Hrynevytskyi (FE-underwriting) 2022-06-14 22:10:39 +03:00 committed by GitHub
parent 4eaa0f6d13
commit 5a0b9fbe50
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -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;

View file

@ -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
});
};