Skip to content

Commit 3099083

Browse files
committed
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
1 parent 7d18179 commit 3099083

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/interactions/pointer.js

+3-1
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 processedEvents = 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 (processedEvents.has(event)) return; // ignore same event on a shared pointer
167+
processedEvents.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)