From 37517cf0cbeed01ea2c7b72c5a75f6a1c9c172d7 Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Fri, 16 Jun 2023 08:11:56 -0700 Subject: [PATCH 1/4] pointer-events: none when not sticky --- src/interactions/pointer.js | 8 +++++--- src/style.js | 3 ++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/interactions/pointer.js b/src/interactions/pointer.js index 72f1b2d7a8..ef5f9628be 100644 --- a/src/interactions/pointer.js +++ b/src/interactions/pointer.js @@ -68,6 +68,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op let i; // currently focused index let g; // currently rendered mark + let s; // currently rendered stickiness let f; // current animation frame // When faceting, if more than one pointer would be visible, only show @@ -97,11 +98,12 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op } function render(ii) { - if (i === ii) return; // the tooltip hasn’t moved + if (i === ii && s === state.sticky) return; // the tooltip hasn’t moved i = ii; + s = state.sticky; const I = i == null ? [] : [i]; if (faceted) (I.fx = index.fx), (I.fy = index.fy), (I.fi = index.fi); - const r = next(I, scales, values, dimensions, context); + const r = next(I, scales, values, dimensions, {...context, pointerSticky: s}); if (g) { // When faceting, preserve swapped mark and facet transforms; also // remove ARIA attributes since these are promoted to the parent. This @@ -144,7 +146,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op if (i == null) return; // not pointing if (state.sticky && state.roots.some((r) => r?.contains(event.target))) return; // stay sticky if (state.sticky) (state.sticky = false), state.renders.forEach((r) => r(null)); // clear all pointers - else state.sticky = true; + else (state.sticky = true), render(i); event.stopImmediatePropagation(); // suppress other pointers } diff --git a/src/style.js b/src/style.js index c239fa56ab..38c55c6968 100644 --- a/src/style.js +++ b/src/style.js @@ -377,7 +377,8 @@ export function applyIndirectStyles(selection, mark, dimensions, context) { applyAttr(selection, "shape-rendering", mark.shapeRendering); applyAttr(selection, "filter", mark.imageFilter); applyAttr(selection, "paint-order", mark.paintOrder); - applyAttr(selection, "pointer-events", mark.pointerEvents); + const {pointerEvents = context.pointerSticky === false ? "none" : undefined} = mark; + applyAttr(selection, "pointer-events", pointerEvents); } export function applyDirectStyles(selection, mark) { From 648bfd5a949b6bab54af807ff1813e7f6f807406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Fri, 16 Jun 2023 19:04:17 +0200 Subject: [PATCH 2/4] add missing context in call to applyIndirectStyles --- src/marks/rule.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/marks/rule.js b/src/marks/rule.js index 09e67aebc6..8fc091dfe3 100644 --- a/src/marks/rule.js +++ b/src/marks/rule.js @@ -35,7 +35,7 @@ export class RuleX extends Mark { const {width, height, marginTop, marginRight, marginLeft, marginBottom} = dimensions; const {insetTop, insetBottom} = this; return create("svg:g", context) - .call(applyIndirectStyles, this, dimensions) + .call(applyIndirectStyles, this, dimensions, context) .call(applyTransform, this, {x: X && x}, offset, 0) .call((g) => g From 9589596f12ec92853765080d40f7e4156f2acbbd Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Sat, 17 Jun 2023 08:32:11 -0700 Subject: [PATCH 3/4] regenerate snapshots --- test/output/autoArea.svg | 2 +- test/output/autoAreaColor.svg | 2 +- test/output/autoAreaColorColor.svg | 2 +- test/output/autoAreaColorName.svg | 2 +- test/output/autoAreaColorValue.svg | 2 +- test/output/autoAreaStackColor.svg | 2 +- test/output/autoAutoHistogram.svg | 2 +- test/output/autoBar.svg | 2 +- test/output/autoBarColorReducer.svg | 2 +- test/output/autoBarMode.svg | 2 +- test/output/autoBarNoReducer.svg | 2 +- test/output/autoBarNonZeroReducer.svg | 2 +- test/output/autoBarStackColor.svg | 2 +- test/output/autoBarStackColorConstant.svg | 2 +- test/output/autoBarStackColorField.svg | 2 +- test/output/autoChannels.svg | 2 +- test/output/autoConnectedScatterplot.svg | 2 +- test/output/autoDot.svg | 2 +- test/output/autoDotBin.svg | 2 +- test/output/autoDotColor.svg | 2 +- test/output/autoDotFacet.svg | 6 ++--- test/output/autoDotFacet2.svg | 10 ++++---- test/output/autoDotGroup.svg | 2 +- test/output/autoDotOrdCont.svg | 2 +- test/output/autoDotOrdinal.svg | 2 +- test/output/autoDotSize.svg | 2 +- test/output/autoDotSize2.svg | 2 +- test/output/autoDotUnsortedDate.svg | 2 +- test/output/autoDotZero.svg | 2 +- test/output/autoHeatmap.svg | 2 +- test/output/autoHeatmapOrdCont.svg | 2 +- test/output/autoHeatmapOrdinal.svg | 2 +- test/output/autoHistogram.svg | 2 +- test/output/autoHistogramDate.svg | 2 +- test/output/autoHistogramGroup.svg | 2 +- test/output/autoLine.svg | 2 +- test/output/autoLineColor.svg | 2 +- test/output/autoLineColorSeries.svg | 2 +- test/output/autoLineFacet.svg | 28 +++++++++++------------ test/output/autoLineHistogram.svg | 2 +- test/output/autoLineMean.svg | 2 +- test/output/autoLineMeanColor.svg | 2 +- test/output/autoLineMeanThresholds.svg | 2 +- test/output/autoLineMeanZero.svg | 2 +- test/output/autoLineZero.svg | 2 +- test/output/autoNullReduceContinuous.svg | 2 +- test/output/autoNullReduceDate.svg | 2 +- test/output/autoNullReduceOrdinal.svg | 2 +- test/output/autoRectColorReducer.svg | 2 +- test/output/autoRectStackColor.svg | 2 +- test/output/autoRuleZero.svg | 2 +- test/output/bigint1.svg | 2 +- test/output/crosshairDodge.svg | 4 ++-- test/output/crosshairDot.svg | 8 +++---- test/output/crosshairDotFacet.svg | 24 +++++++++---------- test/output/crosshairHexbin.svg | 8 +++---- test/output/crosshairLine.svg | 8 +++---- test/output/pointerRenderCompose.svg | 2 +- test/output/pointerViewof.html | 2 +- test/output/tipAreaStack.svg | 2 +- test/output/tipBar.svg | 2 +- test/output/tipBin.svg | 2 +- test/output/tipBinStack.svg | 2 +- test/output/tipCell.svg | 2 +- test/output/tipCellFacet.svg | 4 ++-- test/output/tipDodge.svg | 2 +- test/output/tipDot.svg | 2 +- test/output/tipDotFacets.svg | 14 ++++++------ test/output/tipDotFilter.svg | 4 ++-- test/output/tipDotX.svg | 2 +- test/output/tipGeoCentroid.svg | 4 ++-- test/output/tipGroupPrimitives.svg | 2 +- test/output/tipHexbin.svg | 2 +- test/output/tipHexbinExplicit.svg | 2 +- test/output/tipLine.svg | 2 +- test/output/tipRaster.svg | 2 +- test/output/tipRule.svg | 2 +- test/output/tipRuleAnchored.svg | 2 +- test/output/tipTransform.html | 2 +- 79 files changed, 128 insertions(+), 128 deletions(-) diff --git a/test/output/autoArea.svg b/test/output/autoArea.svg index 6e40b095fc..79aa3eae9d 100644 --- a/test/output/autoArea.svg +++ b/test/output/autoArea.svg @@ -60,5 +60,5 @@ - + \ No newline at end of file diff --git a/test/output/autoAreaColor.svg b/test/output/autoAreaColor.svg index cc9cc33aad..e41947ef38 100644 --- a/test/output/autoAreaColor.svg +++ b/test/output/autoAreaColor.svg @@ -1260,5 +1260,5 @@ - + \ No newline at end of file diff --git a/test/output/autoAreaColorColor.svg b/test/output/autoAreaColorColor.svg index 27ed307d9a..09823aeb23 100644 --- a/test/output/autoAreaColorColor.svg +++ b/test/output/autoAreaColorColor.svg @@ -60,5 +60,5 @@ - + \ No newline at end of file diff --git a/test/output/autoAreaColorName.svg b/test/output/autoAreaColorName.svg index 27ed307d9a..09823aeb23 100644 --- a/test/output/autoAreaColorName.svg +++ b/test/output/autoAreaColorName.svg @@ -60,5 +60,5 @@ - + \ No newline at end of file diff --git a/test/output/autoAreaColorValue.svg b/test/output/autoAreaColorValue.svg index cc9cc33aad..e41947ef38 100644 --- a/test/output/autoAreaColorValue.svg +++ b/test/output/autoAreaColorValue.svg @@ -1260,5 +1260,5 @@ - + \ No newline at end of file diff --git a/test/output/autoAreaStackColor.svg b/test/output/autoAreaStackColor.svg index 254842df4a..f9807587e5 100644 --- a/test/output/autoAreaStackColor.svg +++ b/test/output/autoAreaStackColor.svg @@ -81,5 +81,5 @@ - + \ No newline at end of file diff --git a/test/output/autoAutoHistogram.svg b/test/output/autoAutoHistogram.svg index 6a202a7dd9..f95aabb502 100644 --- a/test/output/autoAutoHistogram.svg +++ b/test/output/autoAutoHistogram.svg @@ -67,5 +67,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBar.svg b/test/output/autoBar.svg index 873c381d47..8cf14d068c 100644 --- a/test/output/autoBar.svg +++ b/test/output/autoBar.svg @@ -124,5 +124,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarColorReducer.svg b/test/output/autoBarColorReducer.svg index 2c66dbe3d7..0a939ad063 100644 --- a/test/output/autoBarColorReducer.svg +++ b/test/output/autoBarColorReducer.svg @@ -57,5 +57,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarMode.svg b/test/output/autoBarMode.svg index 12b49e714e..a2df39abc5 100644 --- a/test/output/autoBarMode.svg +++ b/test/output/autoBarMode.svg @@ -44,5 +44,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarNoReducer.svg b/test/output/autoBarNoReducer.svg index 81e595ffbc..7528a83038 100644 --- a/test/output/autoBarNoReducer.svg +++ b/test/output/autoBarNoReducer.svg @@ -732,5 +732,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarNonZeroReducer.svg b/test/output/autoBarNonZeroReducer.svg index 227f3ddb84..9e083c6dbf 100644 --- a/test/output/autoBarNonZeroReducer.svg +++ b/test/output/autoBarNonZeroReducer.svg @@ -121,5 +121,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarStackColor.svg b/test/output/autoBarStackColor.svg index 92d2c61cab..9b019c8685 100644 --- a/test/output/autoBarStackColor.svg +++ b/test/output/autoBarStackColor.svg @@ -62,5 +62,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarStackColorConstant.svg b/test/output/autoBarStackColorConstant.svg index 0c51ff9975..35cc79607f 100644 --- a/test/output/autoBarStackColorConstant.svg +++ b/test/output/autoBarStackColorConstant.svg @@ -118,5 +118,5 @@ - + \ No newline at end of file diff --git a/test/output/autoBarStackColorField.svg b/test/output/autoBarStackColorField.svg index 5586559226..3ba59009a9 100644 --- a/test/output/autoBarStackColorField.svg +++ b/test/output/autoBarStackColorField.svg @@ -173,5 +173,5 @@ - + \ No newline at end of file diff --git a/test/output/autoChannels.svg b/test/output/autoChannels.svg index b699889687..45c8e3f586 100644 --- a/test/output/autoChannels.svg +++ b/test/output/autoChannels.svg @@ -11307,5 +11307,5 @@ - + \ No newline at end of file diff --git a/test/output/autoConnectedScatterplot.svg b/test/output/autoConnectedScatterplot.svg index 18e4198d0c..baa0429c36 100644 --- a/test/output/autoConnectedScatterplot.svg +++ b/test/output/autoConnectedScatterplot.svg @@ -64,5 +64,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDot.svg b/test/output/autoDot.svg index 4f7489afbc..48baa508ae 100644 --- a/test/output/autoDot.svg +++ b/test/output/autoDot.svg @@ -395,5 +395,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotBin.svg b/test/output/autoDotBin.svg index 80ce1aa876..e482e88392 100644 --- a/test/output/autoDotBin.svg +++ b/test/output/autoDotBin.svg @@ -115,5 +115,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotColor.svg b/test/output/autoDotColor.svg index ee830cd60d..5b8bf803e1 100644 --- a/test/output/autoDotColor.svg +++ b/test/output/autoDotColor.svg @@ -461,5 +461,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotFacet.svg b/test/output/autoDotFacet.svg index c00103c25e..644e8bd592 100644 --- a/test/output/autoDotFacet.svg +++ b/test/output/autoDotFacet.svg @@ -451,8 +451,8 @@ - - - + + + \ No newline at end of file diff --git a/test/output/autoDotFacet2.svg b/test/output/autoDotFacet2.svg index 87a466f49e..d515d82c8d 100644 --- a/test/output/autoDotFacet2.svg +++ b/test/output/autoDotFacet2.svg @@ -491,10 +491,10 @@ - - - - - + + + + + \ No newline at end of file diff --git a/test/output/autoDotGroup.svg b/test/output/autoDotGroup.svg index 6b31c0f580..255480d5bd 100644 --- a/test/output/autoDotGroup.svg +++ b/test/output/autoDotGroup.svg @@ -46,5 +46,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotOrdCont.svg b/test/output/autoDotOrdCont.svg index b3a68b1b5d..de4a5fa70b 100644 --- a/test/output/autoDotOrdCont.svg +++ b/test/output/autoDotOrdCont.svg @@ -387,5 +387,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotOrdinal.svg b/test/output/autoDotOrdinal.svg index 92c35ec91c..4a4b8f3ba0 100644 --- a/test/output/autoDotOrdinal.svg +++ b/test/output/autoDotOrdinal.svg @@ -855,5 +855,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotSize.svg b/test/output/autoDotSize.svg index 911d7af5a9..25400d6092 100644 --- a/test/output/autoDotSize.svg +++ b/test/output/autoDotSize.svg @@ -1289,5 +1289,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotSize2.svg b/test/output/autoDotSize2.svg index 4d6046f2c6..258403ed7e 100644 --- a/test/output/autoDotSize2.svg +++ b/test/output/autoDotSize2.svg @@ -397,5 +397,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotUnsortedDate.svg b/test/output/autoDotUnsortedDate.svg index c60edb4130..11f25a36ad 100644 --- a/test/output/autoDotUnsortedDate.svg +++ b/test/output/autoDotUnsortedDate.svg @@ -11277,5 +11277,5 @@ - + \ No newline at end of file diff --git a/test/output/autoDotZero.svg b/test/output/autoDotZero.svg index b80fa592e3..4676c4f3c2 100644 --- a/test/output/autoDotZero.svg +++ b/test/output/autoDotZero.svg @@ -124,5 +124,5 @@ - + \ No newline at end of file diff --git a/test/output/autoHeatmap.svg b/test/output/autoHeatmap.svg index d1d8d80c6e..0ea35b80e7 100644 --- a/test/output/autoHeatmap.svg +++ b/test/output/autoHeatmap.svg @@ -121,5 +121,5 @@ - + \ No newline at end of file diff --git a/test/output/autoHeatmapOrdCont.svg b/test/output/autoHeatmapOrdCont.svg index e1beba4b13..d19ba56ac3 100644 --- a/test/output/autoHeatmapOrdCont.svg +++ b/test/output/autoHeatmapOrdCont.svg @@ -73,5 +73,5 @@ - + \ No newline at end of file diff --git a/test/output/autoHeatmapOrdinal.svg b/test/output/autoHeatmapOrdinal.svg index 5c0e3e4f03..55ef16b202 100644 --- a/test/output/autoHeatmapOrdinal.svg +++ b/test/output/autoHeatmapOrdinal.svg @@ -46,5 +46,5 @@ - + \ No newline at end of file diff --git a/test/output/autoHistogram.svg b/test/output/autoHistogram.svg index 1f842833e4..3af36918ce 100644 --- a/test/output/autoHistogram.svg +++ b/test/output/autoHistogram.svg @@ -141,5 +141,5 @@ - + \ No newline at end of file diff --git a/test/output/autoHistogramDate.svg b/test/output/autoHistogramDate.svg index 04936980d3..b07ae693e8 100644 --- a/test/output/autoHistogramDate.svg +++ b/test/output/autoHistogramDate.svg @@ -121,5 +121,5 @@ - + \ No newline at end of file diff --git a/test/output/autoHistogramGroup.svg b/test/output/autoHistogramGroup.svg index 37e1e1ed3f..7dec704e20 100644 --- a/test/output/autoHistogramGroup.svg +++ b/test/output/autoHistogramGroup.svg @@ -59,5 +59,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLine.svg b/test/output/autoLine.svg index 4a1d9412d9..c4a3187007 100644 --- a/test/output/autoLine.svg +++ b/test/output/autoLine.svg @@ -65,5 +65,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineColor.svg b/test/output/autoLineColor.svg index 040c20dec4..897a16cc9f 100644 --- a/test/output/autoLineColor.svg +++ b/test/output/autoLineColor.svg @@ -1265,5 +1265,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineColorSeries.svg b/test/output/autoLineColorSeries.svg index 58f44896fd..00f1b26d20 100644 --- a/test/output/autoLineColorSeries.svg +++ b/test/output/autoLineColorSeries.svg @@ -86,5 +86,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineFacet.svg b/test/output/autoLineFacet.svg index f8a087c5e9..26574e9010 100644 --- a/test/output/autoLineFacet.svg +++ b/test/output/autoLineFacet.svg @@ -260,19 +260,19 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/output/autoLineHistogram.svg b/test/output/autoLineHistogram.svg index e2266b545a..211fbb7825 100644 --- a/test/output/autoLineHistogram.svg +++ b/test/output/autoLineHistogram.svg @@ -71,5 +71,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineMean.svg b/test/output/autoLineMean.svg index 2d9608f259..c39bcdbeee 100644 --- a/test/output/autoLineMean.svg +++ b/test/output/autoLineMean.svg @@ -49,5 +49,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineMeanColor.svg b/test/output/autoLineMeanColor.svg index ea7699d075..0acdd68044 100644 --- a/test/output/autoLineMeanColor.svg +++ b/test/output/autoLineMeanColor.svg @@ -65,5 +65,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineMeanThresholds.svg b/test/output/autoLineMeanThresholds.svg index 09caafd181..e32145a840 100644 --- a/test/output/autoLineMeanThresholds.svg +++ b/test/output/autoLineMeanThresholds.svg @@ -55,5 +55,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineMeanZero.svg b/test/output/autoLineMeanZero.svg index 4aeac11c28..a164072f5f 100644 --- a/test/output/autoLineMeanZero.svg +++ b/test/output/autoLineMeanZero.svg @@ -62,5 +62,5 @@ - + \ No newline at end of file diff --git a/test/output/autoLineZero.svg b/test/output/autoLineZero.svg index 17fc92f071..591ee68c3e 100644 --- a/test/output/autoLineZero.svg +++ b/test/output/autoLineZero.svg @@ -91,5 +91,5 @@ - + \ No newline at end of file diff --git a/test/output/autoNullReduceContinuous.svg b/test/output/autoNullReduceContinuous.svg index 0d787b6a34..f8f053b76c 100644 --- a/test/output/autoNullReduceContinuous.svg +++ b/test/output/autoNullReduceContinuous.svg @@ -374,5 +374,5 @@ - + \ No newline at end of file diff --git a/test/output/autoNullReduceDate.svg b/test/output/autoNullReduceDate.svg index 119addad42..74d24996d2 100644 --- a/test/output/autoNullReduceDate.svg +++ b/test/output/autoNullReduceDate.svg @@ -11580,5 +11580,5 @@ - + \ No newline at end of file diff --git a/test/output/autoNullReduceOrdinal.svg b/test/output/autoNullReduceOrdinal.svg index b3f5abed33..2558830673 100644 --- a/test/output/autoNullReduceOrdinal.svg +++ b/test/output/autoNullReduceOrdinal.svg @@ -31,5 +31,5 @@ - + \ No newline at end of file diff --git a/test/output/autoRectColorReducer.svg b/test/output/autoRectColorReducer.svg index 6c6e40576d..3ef4421c15 100644 --- a/test/output/autoRectColorReducer.svg +++ b/test/output/autoRectColorReducer.svg @@ -75,5 +75,5 @@ - + \ No newline at end of file diff --git a/test/output/autoRectStackColor.svg b/test/output/autoRectStackColor.svg index 81526e4f98..4e7d1a89e1 100644 --- a/test/output/autoRectStackColor.svg +++ b/test/output/autoRectStackColor.svg @@ -95,5 +95,5 @@ - + \ No newline at end of file diff --git a/test/output/autoRuleZero.svg b/test/output/autoRuleZero.svg index b7d4cd4662..f298cb1179 100644 --- a/test/output/autoRuleZero.svg +++ b/test/output/autoRuleZero.svg @@ -121,5 +121,5 @@ - + \ No newline at end of file diff --git a/test/output/bigint1.svg b/test/output/bigint1.svg index 46aa0a8b51..0c78468c35 100644 --- a/test/output/bigint1.svg +++ b/test/output/bigint1.svg @@ -82,5 +82,5 @@ - + \ No newline at end of file diff --git a/test/output/crosshairDodge.svg b/test/output/crosshairDodge.svg index 1928b02332..b5bb02f041 100644 --- a/test/output/crosshairDodge.svg +++ b/test/output/crosshairDodge.svg @@ -374,6 +374,6 @@ - - + + \ No newline at end of file diff --git a/test/output/crosshairDot.svg b/test/output/crosshairDot.svg index b87417e4ff..d310f29258 100644 --- a/test/output/crosshairDot.svg +++ b/test/output/crosshairDot.svg @@ -397,8 +397,8 @@ - - - - + + + + \ No newline at end of file diff --git a/test/output/crosshairDotFacet.svg b/test/output/crosshairDotFacet.svg index 6c5958d5e1..2891d8bd5c 100644 --- a/test/output/crosshairDotFacet.svg +++ b/test/output/crosshairDotFacet.svg @@ -442,23 +442,23 @@ - - - + + + - - - + + + - - - + + + - - - + + + \ No newline at end of file diff --git a/test/output/crosshairHexbin.svg b/test/output/crosshairHexbin.svg index 99d91017a8..4e809bccf8 100644 --- a/test/output/crosshairHexbin.svg +++ b/test/output/crosshairHexbin.svg @@ -302,8 +302,8 @@ - - - - + + + + \ No newline at end of file diff --git a/test/output/crosshairLine.svg b/test/output/crosshairLine.svg index 714f0c0819..7298cd8414 100644 --- a/test/output/crosshairLine.svg +++ b/test/output/crosshairLine.svg @@ -65,8 +65,8 @@ - - - - + + + + \ No newline at end of file diff --git a/test/output/pointerRenderCompose.svg b/test/output/pointerRenderCompose.svg index dd0d1c367f..1557462e9c 100644 --- a/test/output/pointerRenderCompose.svg +++ b/test/output/pointerRenderCompose.svg @@ -53,7 +53,7 @@ culmen_length_mm → - + diff --git a/test/output/pointerViewof.html b/test/output/pointerViewof.html index decf83aef9..c5fb990f89 100644 --- a/test/output/pointerViewof.html +++ b/test/output/pointerViewof.html @@ -397,7 +397,7 @@ - + \ No newline at end of file diff --git a/test/output/tipAreaStack.svg b/test/output/tipAreaStack.svg index 768d2891e2..9e109a2acb 100644 --- a/test/output/tipAreaStack.svg +++ b/test/output/tipAreaStack.svg @@ -68,5 +68,5 @@ - + \ No newline at end of file diff --git a/test/output/tipBar.svg b/test/output/tipBar.svg index 89403a504b..e470216044 100644 --- a/test/output/tipBar.svg +++ b/test/output/tipBar.svg @@ -123,5 +123,5 @@ - + \ No newline at end of file diff --git a/test/output/tipBin.svg b/test/output/tipBin.svg index 5a315ad72c..d990379108 100644 --- a/test/output/tipBin.svg +++ b/test/output/tipBin.svg @@ -138,5 +138,5 @@ - + \ No newline at end of file diff --git a/test/output/tipBinStack.svg b/test/output/tipBinStack.svg index 9d96f3d16d..b1c2f8d138 100644 --- a/test/output/tipBinStack.svg +++ b/test/output/tipBinStack.svg @@ -185,5 +185,5 @@ - + \ No newline at end of file diff --git a/test/output/tipCell.svg b/test/output/tipCell.svg index 5c72903d12..5b5a26b979 100644 --- a/test/output/tipCell.svg +++ b/test/output/tipCell.svg @@ -145,5 +145,5 @@ - + \ No newline at end of file diff --git a/test/output/tipCellFacet.svg b/test/output/tipCellFacet.svg index 06b40c5f6f..7dac76253b 100644 --- a/test/output/tipCellFacet.svg +++ b/test/output/tipCellFacet.svg @@ -154,7 +154,7 @@ - - + + \ No newline at end of file diff --git a/test/output/tipDodge.svg b/test/output/tipDodge.svg index 3127891ebb..17f977cc2d 100644 --- a/test/output/tipDodge.svg +++ b/test/output/tipDodge.svg @@ -374,5 +374,5 @@ - + \ No newline at end of file diff --git a/test/output/tipDot.svg b/test/output/tipDot.svg index 1991c3a98c..ced1791ba3 100644 --- a/test/output/tipDot.svg +++ b/test/output/tipDot.svg @@ -397,5 +397,5 @@ - + \ No newline at end of file diff --git a/test/output/tipDotFacets.svg b/test/output/tipDotFacets.svg index 34b727ba82..94af127248 100644 --- a/test/output/tipDotFacets.svg +++ b/test/output/tipDotFacets.svg @@ -11214,12 +11214,12 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/test/output/tipDotFilter.svg b/test/output/tipDotFilter.svg index 172bb3ef50..ec1742bfbe 100644 --- a/test/output/tipDotFilter.svg +++ b/test/output/tipDotFilter.svg @@ -390,6 +390,6 @@ - - + + \ No newline at end of file diff --git a/test/output/tipDotX.svg b/test/output/tipDotX.svg index 1f683a4786..814b20bd57 100644 --- a/test/output/tipDotX.svg +++ b/test/output/tipDotX.svg @@ -49,5 +49,5 @@ - + \ No newline at end of file diff --git a/test/output/tipGeoCentroid.svg b/test/output/tipGeoCentroid.svg index 462df284b3..11275c03b4 100644 --- a/test/output/tipGeoCentroid.svg +++ b/test/output/tipGeoCentroid.svg @@ -16,6 +16,6 @@ - - + + \ No newline at end of file diff --git a/test/output/tipGroupPrimitives.svg b/test/output/tipGroupPrimitives.svg index 5c08a8e086..2307a9eb1e 100644 --- a/test/output/tipGroupPrimitives.svg +++ b/test/output/tipGroupPrimitives.svg @@ -60,5 +60,5 @@ - + \ No newline at end of file diff --git a/test/output/tipHexbin.svg b/test/output/tipHexbin.svg index 2e6d1ea5f5..9df33103d3 100644 --- a/test/output/tipHexbin.svg +++ b/test/output/tipHexbin.svg @@ -302,5 +302,5 @@ - + \ No newline at end of file diff --git a/test/output/tipHexbinExplicit.svg b/test/output/tipHexbinExplicit.svg index f4ca6b4cc8..1b8bb17266 100644 --- a/test/output/tipHexbinExplicit.svg +++ b/test/output/tipHexbinExplicit.svg @@ -302,5 +302,5 @@ - + \ No newline at end of file diff --git a/test/output/tipLine.svg b/test/output/tipLine.svg index 4a1d9412d9..c4a3187007 100644 --- a/test/output/tipLine.svg +++ b/test/output/tipLine.svg @@ -65,5 +65,5 @@ - + \ No newline at end of file diff --git a/test/output/tipRaster.svg b/test/output/tipRaster.svg index 66a9e730af..b680582935 100644 --- a/test/output/tipRaster.svg +++ b/test/output/tipRaster.svg @@ -16,5 +16,5 @@ - + \ No newline at end of file diff --git a/test/output/tipRule.svg b/test/output/tipRule.svg index 99b687131f..2e4c4fe4f6 100644 --- a/test/output/tipRule.svg +++ b/test/output/tipRule.svg @@ -378,5 +378,5 @@ - + \ No newline at end of file diff --git a/test/output/tipRuleAnchored.svg b/test/output/tipRuleAnchored.svg index e077cfcc19..db381ae45b 100644 --- a/test/output/tipRuleAnchored.svg +++ b/test/output/tipRuleAnchored.svg @@ -378,5 +378,5 @@ - + \ No newline at end of file diff --git a/test/output/tipTransform.html b/test/output/tipTransform.html index f3e1362aec..301d397b0e 100644 --- a/test/output/tipTransform.html +++ b/test/output/tipTransform.html @@ -71,5 +71,5 @@ - + \ No newline at end of file From 6eb1c86ffffed3c96eb39e5ede9e2301c2ac95dd Mon Sep 17 00:00:00 2001 From: Mike Bostock Date: Mon, 19 Jun 2023 08:25:09 -0700 Subject: [PATCH 4/4] greedy context copy --- src/interactions/pointer.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/interactions/pointer.js b/src/interactions/pointer.js index ef5f9628be..70555efd3d 100644 --- a/src/interactions/pointer.js +++ b/src/interactions/pointer.js @@ -21,6 +21,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op // outermost render function because it will re-render dynamically in // response to pointer events. render: composeRender(function (index, scales, values, dimensions, context, next) { + context = {...context, pointerSticky: false}; const svg = context.ownerSVGElement; const {data} = context.getMarkState(this); @@ -100,10 +101,10 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op function render(ii) { if (i === ii && s === state.sticky) return; // the tooltip hasn’t moved i = ii; - s = state.sticky; + s = context.pointerSticky = state.sticky; const I = i == null ? [] : [i]; if (faceted) (I.fx = index.fx), (I.fy = index.fy), (I.fi = index.fi); - const r = next(I, scales, values, dimensions, {...context, pointerSticky: s}); + const r = next(I, scales, values, dimensions, context); if (g) { // When faceting, preserve swapped mark and facet transforms; also // remove ARIA attributes since these are promoted to the parent. This