Use entityNearest() rather than entityNearestByXThenY() for LinePlot.entitiesAt()#3558
Open
mcintyret wants to merge 1 commit into
Open
Use entityNearest() rather than entityNearestByXThenY() for LinePlot.entitiesAt()#3558mcintyret wants to merge 1 commit into
mcintyret wants to merge 1 commit into
Conversation
Use entityNearest() rather than entityNearestByXThenWhy() for LinePlot.entitiesAt()Demo: quicktests | fiddle |
themadcreator
suggested changes
Dec 1, 2020
Contributor
themadcreator
left a comment
There was a problem hiding this comment.
Let's leave the "unused" method since it's public
| } | ||
| } | ||
|
|
||
| /** |
Contributor
There was a problem hiding this comment.
Maybe we shouldn't delete this because technically this would be a public API break and require a major version bump
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Usinig
entityNearestByXThenYcauses some weird behaviour - if the cursor is marginally closer in the x domain to another point than the one the user intended to click on, that point will be the one that gets selected - even if it is hundreds of pixels away in the y domain.Even worse, the tooltip-on-hover codepath just uses
entityNearest(), so the intuitive nearest point has a tooltip, but then clicking selects a different point.I went through the git history and couldn't see any reason why the "by x then y" approach was taken, but may well be missing something.
Hovering showing the nearest point:

After clicking at that exact same cursor location:

After this PR, the selected point is the expected one.