Skip to content

Commit b10e126

Browse files
committed
Return the usual euclidian distance to determine the winner across facets, not the squashed distance.
fixes #1776
1 parent 13b5223 commit b10e126

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/interactions/pointer.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
127127
return r;
128128
}
129129

130+
// Select the closest point to the mouse in the current facet; for
131+
// pointerX or pointerY, the orthogonal component of the distance is
132+
// squashed, selecting primarily on the dominant dimension. Return the
133+
// usual euclidian distance to determine the winner across facets.
130134
function pointermove(event) {
131135
if (state.sticky || (event.pointerType === "mouse" && event.buttons === 1)) return; // dragging
132136
let [xp, yp] = pointof(event);
@@ -139,7 +143,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
139143
const rj = dx * dx + dy * dy;
140144
if (rj <= ri) (ii = j), (ri = rj);
141145
}
142-
update(ii, ri);
146+
update(ii, Math.hypot(px(ii) - xp, py(ii) - yp));
143147
}
144148

145149
function pointerdown(event) {

0 commit comments

Comments
 (0)