From 9a3dc5fff3356afa0935bb1e830631b090b45d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Wed, 2 Aug 2023 08:53:23 +0200 Subject: [PATCH 1/2] When simultaneously exiting a facet and entering a new one, prioritize dispatching the value from the entering facet. Fixes #1778 --- src/interactions/pointer.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/interactions/pointer.js b/src/interactions/pointer.js index 70555efd3d..7dc3451c40 100644 --- a/src/interactions/pointer.js +++ b/src/interactions/pointer.js @@ -123,7 +123,10 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op g.replaceWith(r); } state.roots[renderIndex] = g = r; - context.dispatchValue(i == null ? null : data[i]); + + // Dispatch the value. When simultaneously exiting this facet and + // entering a new one, prioritize the entering facet. + if (!(i === null && facetState?.size > 1)) context.dispatchValue(i == null ? null : data[i]); return r; } From 734a92977f83e6cdb28afda9925f4bb2c7df7c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Thu, 3 Aug 2023 07:21:13 +0200 Subject: [PATCH 2/2] Update src/interactions/pointer.js Co-authored-by: Mike Bostock --- src/interactions/pointer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/interactions/pointer.js b/src/interactions/pointer.js index 7dc3451c40..9ef06682c9 100644 --- a/src/interactions/pointer.js +++ b/src/interactions/pointer.js @@ -126,7 +126,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op // Dispatch the value. When simultaneously exiting this facet and // entering a new one, prioritize the entering facet. - if (!(i === null && facetState?.size > 1)) context.dispatchValue(i == null ? null : data[i]); + if (!(i == null && facetState?.size > 1)) context.dispatchValue(i == null ? null : data[i]); return r; }