Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

In Artist.contains, check that moussevents occurred on the right canvas.#25546

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
greglucas merged 1 commit intomatplotlib:mainfromanntzer:nsc
Mar 26, 2023

Conversation

anntzer
Copy link
Contributor

The old _default_contains check was geared towards custom contains checkers (set via set_contains), which have been removed. Get rid of that and instead, add a check for canvas identity which is more useful.

Closes#6324.

PR Summary

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (andpytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs shouldbuild without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a.. versionadded:: directive in the docstring and documented indoc/users/next_whats_new/
  • API changes are marked with a.. versionchanged:: directive in the docstring and documented indoc/api/next_api_changes/
  • Release notes conform with instructions innext_whats_new/README.rst ornext_api_changes/README.rst

Comment on lines +474 to +479
return (getattr(event, "canvas", None) is not None and self.figure is not None
and event.canvas is not self.figure.canvas)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Rather than guarding against theNone is None case, could you do something like this instead?

Suggested change
return (getattr(event,"canvas",None)isnotNoneandself.figureisnotNone
andevent.canvasisnotself.figure.canvas)
return (getattr(event,"canvas",object())isnotgetattr(self.figure,"canvas",object())

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I don't think so? That would incorrectly return "different" if event.canvas = None and self.figure != None and self.figure.canvas = anything, I believe?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ahh, yes. My confusion seems to agree with the other confusion on the "maybe"/"for sure" same canvas comments above.

I wonder if there is a way to clear up that maybe_same_canvas by guaranteeing these attributes are set elsewhere in another PR.

The old _default_contains check was geared towards custom containscheckers (set via set_contains), which have been removed.  Get rid ofthat and instead, add a check for canvas identity which is more useful.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm approved these changes

@greglucasgreglucasgreglucas approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.8.0
Development

Successfully merging this pull request may close these issues.

artist.contains should check that the event occurred in the same figure
4 participants
@anntzer@timhoffm@greglucas@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp