From c9d0f13328903bee1f59ebd3ce955d1eda1d19b6 Mon Sep 17 00:00:00 2001 From: moklick Date: Mon, 10 Jun 2024 11:47:18 +0200 Subject: [PATCH] fix(handles): calc offset correctly --- examples/react/src/examples/DragNDrop/index.tsx | 1 + packages/system/src/utils/dom.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/react/src/examples/DragNDrop/index.tsx b/examples/react/src/examples/DragNDrop/index.tsx index 83c7bb4e..10a2eff4 100644 --- a/examples/react/src/examples/DragNDrop/index.tsx +++ b/examples/react/src/examples/DragNDrop/index.tsx @@ -77,6 +77,7 @@ const DnDFlow = () => { onInit={onInit} onDrop={onDrop} onDragOver={onDragOver} + nodeOrigin={nodeOrigin} > diff --git a/packages/system/src/utils/dom.ts b/packages/system/src/utils/dom.ts index d4dc1194..850e6724 100644 --- a/packages/system/src/utils/dom.ts +++ b/packages/system/src/utils/dom.ts @@ -74,8 +74,8 @@ export const getHandleBounds = ( const handlesArray = Array.from(handles) as HTMLDivElement[]; const nodeOffset = { - x: nodeBounds.left - nodeBounds.width * nodeOrigin[0], - y: nodeBounds.top - nodeBounds.height * nodeOrigin[1], + x: nodeBounds.left + nodeBounds.width * nodeOrigin[0], + y: nodeBounds.top + nodeBounds.height * nodeOrigin[1], }; return handlesArray.map((handle): HandleElement => {