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.
Conversation
Why do we need a custom picker / why does the regular picker fire on scroll events? Should it be fixed generally on the regular picker? |
A scroll event comes in looking just like a button press (but with a higher number). It does not seem unreasonable to allow these to trigger pick events in general but to disable them for draggable things specifically. |
timhoffm commentedApr 1, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I don't think I understand this: "Pick" is logically selecting an element by clicking on it. No matter the technical implementation, why should scrolling ever be interpreted as pick? In what use case would that make sense? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Anybody can merge after adding the suggested documentation.
@@ -1500,6 +1500,10 @@ def __init__(self, ref_artist, use_blit=False): | |||
] | |||
] | |||
@staticmethod | |||
def _picker(artist, mouseevent): | |||
return (artist.contains(mouseevent) and mouseevent.name != "scroll_event"), {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
return (artist.contains(mouseevent)andmouseevent.name!="scroll_event"), {} | |
""" | |
Acustompickertopreventdraggingonscrollevents. | |
Draggingisinitializedthroughapickevents,whichistypicallya | |
mouseclick.However,mousescrollingalsofirespickeventsand | |
weneedtofilterthemoutsothatscrollingdoesnotinitalize | |
dragging. | |
""" | |
return (artist.contains(mouseevent)andmouseevent.name!="scroll_event"), {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The 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?
Uh oh!
There was an error while loading.Please reload this page.
a364dc5
intomatplotlib:mainUh oh!
There was an error while loading.Please reload this page.
PR summary
Fixes#29142; replaces#29270. The solution here is to set a custom picker on
DraggableBase
that doesn't fire if the event is a scroll event.PR checklist