Fix OffsetBox custom picker#30096
Merged
timhoffm merged 1 commit intomatplotlib:mainfrom May 24, 2025
Merged
Conversation
Contributor
|
Are you able to bring one of the tests from mplcursors over to get coverage of the new line? |
Member
Author
|
Possibly, but they all use |
anntzer
approved these changes
May 23, 2025
Contributor
There was a problem hiding this comment.
Looks correct, and definitely fixes mplcursors' test suite. A test would be nice indeed.
Also the logic looks a bit inverted, I'd write this as if mouseevent.name == "scroll_event": return False, {} else: return artist.contains(mouseevent), not that it really matters.
As with the custom picker, `Artist.contains` returns a boolean and a dictionary in a tuple. This non-empty tuple is always true, so the custom picker would always return True for any non-scroll event. It would also lose the related dictionary.
5ad52e9 to
731f454
Compare
timhoffm
approved these changes
May 24, 2025
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
May 24, 2025
This was referenced Aug 14, 2025
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.
PR summary
As with the custom picker,
Artist.containsreturns a boolean and a dictionary in a tuple. This non-empty tuple is always true, so the custom picker would always return True for any non-scroll event. It would also lose the related dictionary.This broke
mplcursorstests.PR checklist