Skip to content

Commit 729be1d

Browse files
authored
let the pointer's pointerdown event propagate (#2267)
* ignore the same event if it's already been processed (this typically happens on the crosshair mark which uses the same shared pointer transform on its submarks) closes #2052 * handledEvents
1 parent 569e0f1 commit 729be1d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/interactions/pointer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {isArray} from "../options.js";
44
import {applyFrameAnchor} from "../style.js";
55

66
const states = new WeakMap();
7+
const handledEvents = new WeakSet();
78

89
function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...options} = {}) {
910
maxRadius = +maxRadius;
@@ -162,12 +163,13 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
162163
}
163164

164165
function pointerdown(event) {
166+
if (handledEvents.has(event)) return; // ignore same event on a shared pointer
167+
handledEvents.add(event);
165168
if (event.pointerType !== "mouse") return;
166169
if (i == null) return; // not pointing
167170
if (state.sticky && state.roots.some((r) => r?.contains(event.target))) return; // stay sticky
168171
if (state.sticky) (state.sticky = false), state.renders.forEach((r) => r(null)); // clear all pointers
169172
else (state.sticky = true), render(i);
170-
event.stopImmediatePropagation(); // suppress other pointers
171173
}
172174

173175
function pointerleave(event) {

0 commit comments

Comments
 (0)