feat(react) added screenToFlowCoordinate & flowToScreenCoordinate

This commit is contained in:
Peter
2023-10-05 10:34:58 +02:00
parent e46c3cddaa
commit 2d2f642c82
3 changed files with 41 additions and 3 deletions
@@ -49,9 +49,9 @@ const DnDFlow = () => {
if (reactFlowInstance) {
const type = event.dataTransfer.getData('application/reactflow');
const position = reactFlowInstance.project({
const position = reactFlowInstance.screenToFlowCoordinate({
x: event.clientX,
y: event.clientY - 40,
y: event.clientY,
});
const newNode: Node = {
id: getId(),