Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/interactions/pointer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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], s);
return r;
}

Expand Down
16 changes: 13 additions & 3 deletions src/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,21 @@ export function plot(options = {}) {
return {...state, channels: {...state.channels, ...facetState?.channels}};
};

class StickyEvent extends Event {
constructor(type, options) {
super(type, options);
this.sticky = options.sticky;
}
}

context.stickyState = undefined;

// Allows e.g. the pointer transform to support viewof.
context.dispatchValue = (value) => {
if (figure.value === value) return;
context.dispatchValue = (value, sticky) => {
if (figure.value === value && context.stickyState === sticky) return;
figure.value = value;
figure.dispatchEvent(new Event("input", {bubbles: true}));
context.stickyState = sticky;
figure.dispatchEvent(new StickyEvent("input", {bubbles: true, sticky}));
};

// Reinitialize; for deriving channels dependent on other channels.
Expand Down
Loading