fix(handles): calc offset correctly

This commit is contained in:
moklick
2024-06-10 11:47:18 +02:00
parent 5d6ac6e316
commit c9d0f13328
2 changed files with 3 additions and 2 deletions
@@ -77,6 +77,7 @@ const DnDFlow = () => {
onInit={onInit} onInit={onInit}
onDrop={onDrop} onDrop={onDrop}
onDragOver={onDragOver} onDragOver={onDragOver}
nodeOrigin={nodeOrigin}
> >
<Controls /> <Controls />
</ReactFlow> </ReactFlow>
+2 -2
View File
@@ -74,8 +74,8 @@ export const getHandleBounds = (
const handlesArray = Array.from(handles) as HTMLDivElement[]; const handlesArray = Array.from(handles) as HTMLDivElement[];
const nodeOffset = { const nodeOffset = {
x: nodeBounds.left - nodeBounds.width * nodeOrigin[0], x: nodeBounds.left + nodeBounds.width * nodeOrigin[0],
y: nodeBounds.top - nodeBounds.height * nodeOrigin[1], y: nodeBounds.top + nodeBounds.height * nodeOrigin[1],
}; };
return handlesArray.map((handle): HandleElement => { return handlesArray.map((handle): HandleElement => {