Skip to content

Commit 6eb1c86

Browse files
committed
greedy context copy
1 parent 9589596 commit 6eb1c86

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/interactions/pointer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
2121
// outermost render function because it will re-render dynamically in
2222
// response to pointer events.
2323
render: composeRender(function (index, scales, values, dimensions, context, next) {
24+
context = {...context, pointerSticky: false};
2425
const svg = context.ownerSVGElement;
2526
const {data} = context.getMarkState(this);
2627

@@ -100,10 +101,10 @@ function pointerK(kx, ky, {x, y, px, py, maxRadius = 40, channels, render, ...op
100101
function render(ii) {
101102
if (i === ii && s === state.sticky) return; // the tooltip hasn’t moved
102103
i = ii;
103-
s = state.sticky;
104+
s = context.pointerSticky = state.sticky;
104105
const I = i == null ? [] : [i];
105106
if (faceted) (I.fx = index.fx), (I.fy = index.fy), (I.fi = index.fi);
106-
const r = next(I, scales, values, dimensions, {...context, pointerSticky: s});
107+
const r = next(I, scales, values, dimensions, context);
107108
if (g) {
108109
// When faceting, preserve swapped mark and facet transforms; also
109110
// remove ARIA attributes since these are promoted to the parent. This

0 commit comments

Comments
 (0)