Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Don't drag draggables on scroll events#29842
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1486,7 +1486,7 @@ def finalize_offset(self): | ||||||||||||||||||||||
def __init__(self, ref_artist, use_blit=False): | ||||||||||||||||||||||
self.ref_artist = ref_artist | ||||||||||||||||||||||
if not ref_artist.pickable(): | ||||||||||||||||||||||
ref_artist.set_picker(self._picker) | ||||||||||||||||||||||
self.got_artist = False | ||||||||||||||||||||||
self._use_blit = use_blit and self.canvas.supports_blit | ||||||||||||||||||||||
callbacks = self.canvas.callbacks | ||||||||||||||||||||||
@@ -1500,6 +1500,11 @@ def __init__(self, ref_artist, use_blit=False): | ||||||||||||||||||||||
] | ||||||||||||||||||||||
] | ||||||||||||||||||||||
@staticmethod | ||||||||||||||||||||||
def _picker(artist, mouseevent): | ||||||||||||||||||||||
# A custom picker to prevent dragging on mouse scroll events | ||||||||||||||||||||||
return (artist.contains(mouseevent) and mouseevent.name != "scroll_event"), {} | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. 👍 to adding a comment - I thought this was a bit verbose for a private helper function, so I added a one-liner instead - what do you think?
dstansby marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||||||||||||||||||||||
# A property, not an attribute, to maintain picklability. | ||||||||||||||||||||||
canvas = property(lambda self: self.ref_artist.get_figure(root=True).canvas) | ||||||||||||||||||||||
cids = property(lambda self: [ | ||||||||||||||||||||||
Uh oh!
There was an error while loading.Please reload this page.