Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment: add support for distinguishing hover & click events #1979

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions src/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,11 @@ export function plot(options = {}) {
};

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

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