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

fix a corner case where pointer interaction generates two points #1780

Merged
merged 1 commit into from
Aug 3, 2023

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Aug 2, 2023

Because we're checking for strict inequality of the distance to the best facet, it can happen that we display 2 tips if the pointer is exactly at the same distance from two target points in different facets. This fixes this corner case, by retaining only the first point in case of strict equality.

I've seen it happen once, by chance, when I was playing with https://observablehq.com/d/a03f70ae5c5962c4 — so I'm sure it can happen in the wild, but it's difficult to reproduce: you need an environment where the pointer has integer coordinates (this depends on the browser, I think?), and the two targets have integer coordinates (e.g., using the round: true option on x — it's on by default on fx).

…est facet, it could happen that we displayed 2 tips if the pointer was exactly at the same distance from two target points in different facets. This fixes this corner case.
@Fil Fil requested a review from mbostock August 2, 2023 07:17
@Fil Fil merged commit 4a80eb0 into main Aug 3, 2023
1 check passed
@Fil Fil deleted the fil/facet-pointer-equality branch August 3, 2023 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants