Skip to content

Commit e8ab373

Browse files
Filmbostock
authored andcommitted
don't attempt to compute a NaN distance when ii is nullish
1 parent 1625ceb commit e8ab373

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/interactions/pointer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
146146
const rj = dx * dx + dy * dy;
147147
if (rj <= ri) (ii = j), (ri = rj);
148148
}
149-
update(ii, Math.hypot(px(ii) - xp, py(ii) - yp));
149+
update(ii, ii != null && Math.hypot(px(ii) - xp, py(ii) - yp));
150150
}
151151

152152
function pointerdown(event) {

0 commit comments

Comments
 (0)