fix(PageComponent): change position calculation to use screenToFlowPosition instead of project to fix incorrect node creation position
This commit is contained in:
parent
0e078efee0
commit
8e47e7c9d7
1 changed files with 3 additions and 3 deletions
|
|
@ -319,9 +319,9 @@ export default function Page({
|
||||||
);
|
);
|
||||||
|
|
||||||
// Calculate the position where the node should be created
|
// Calculate the position where the node should be created
|
||||||
const position = reactFlowInstance!.project({
|
const position = reactFlowInstance!.screenToFlowPosition({
|
||||||
x: event.clientX - reactflowBounds!.left,
|
x: event.clientX,
|
||||||
y: event.clientY - reactflowBounds!.top,
|
y: event.clientY
|
||||||
});
|
});
|
||||||
|
|
||||||
// Generate a unique node ID
|
// Generate a unique node ID
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue