From dc5d8a052eac800abdebdb1057d2fa4f10f1e0e0 Mon Sep 17 00:00:00 2001 From: Joshua Weinstein Date: Fri, 6 Jan 2023 15:57:38 -0500 Subject: [PATCH] update useProximity getCoords call --- src/helpers/useProximity.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/helpers/useProximity.ts b/src/helpers/useProximity.ts index 72c25f4c..7e519b64 100644 --- a/src/helpers/useProximity.ts +++ b/src/helpers/useProximity.ts @@ -213,7 +213,13 @@ export const useProximity = ({ const ref = canvasRef.current; // @ts-ignore - setMatrix(getCoords(ref)); + setMatrix( + getCoords({ + containerRef: ref.containerRef, + zoom: ref.zoom, + layoutXY: ref.xy + }) + ); setPoints(buildPoints(ref.layout.children)); // eslint-disable-next-line react-hooks/exhaustive-deps }, [disabled]); @@ -224,17 +230,11 @@ export const useProximity = ({ return; } - const { - onMatchChange, - onIntersects, - onDistanceChange - } = eventRefs.current; - - const { - intersectedNodeId, - foundNodeId, - foundDist - } = findNodeIntersection(event, matrix, points, minDistance); + const { onMatchChange, onIntersects, onDistanceChange } = + eventRefs.current; + + const { intersectedNodeId, foundNodeId, foundDist } = + findNodeIntersection(event, matrix, points, minDistance); const nextDist = foundDist !== minDistance ? foundDist : null; if (foundNodeId !== lastMatchRef.current) {