Skip to content

Commit 404d0cb

Browse files
authored
Merge pull request #359 from reaviz/anton/draggable-fix
Fix for the draggable nodes on the resized canvas #279
2 parents 338a7c7 + edb2d59 commit 404d0cb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/useDrag.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ export const useDrag = ({
4646

4747
const clientRect = useMemo(
4848
() => gl.domElement.getBoundingClientRect(),
49-
[gl.domElement]
49+
// Size dependency ensures the clientRect updates when container dimensions change.
50+
// Without it, drag calculations would use stale positioning data from the previous container size.
51+
[gl.domElement, size]
5052
);
5153

5254
return useGesture(

0 commit comments

Comments
 (0)