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

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

Merged
timhoffm merged 3 commits intomatplotlib:mainfromdstansby:scroll-drag
Apr 2, 2025

Conversation

dstansby
Copy link
Member

PR summary

Fixes#29142; replaces#29270. The solution here is to set a custom picker onDraggableBase that doesn't fire if the event is a scroll event.

PR checklist

@tacaswelltacaswell added this to thev3.10.2 milestoneMar 31, 2025
@timhoffm
Copy link
Member

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?

@tacaswell
Copy link
Member

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
Copy link
Member

timhoffm commentedApr 1, 2025
edited
Loading

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?

@dstansby
Copy link
MemberAuthor

pick is possibly an unfortunate choice of language. As an example of a picker that uses scroll, if I wanted to make an artist change size if the mouse is over it and scrolled, then giving a custom function toArtist.set_picker() would be the way to do this.

Copy link
Member

@timhoffmtimhoffm left a 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"), {}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return (artist.contains(mouseevent)andmouseevent.name!="scroll_event"), {}
"""
Acustompickertopreventdraggingonscrollevents.
Draggingisinitializedthroughapickevents,whichistypicallya
mouseclick.However,mousescrollingalsofirespickeventsand
weneedtofilterthemoutsothatscrollingdoesnotinitalize
dragging.
"""
return (artist.contains(mouseevent)andmouseevent.name!="scroll_event"), {}

Copy link
MemberAuthor

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?

timhoffm reacted with thumbs up emoji
@timhoffmtimhoffm merged commita364dc5 intomatplotlib:mainApr 2, 2025
40 checks passed
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull requestApr 2, 2025
@dstansbydstansby deleted the scroll-drag branchApril 2, 2025 18:42
@ksundenksunden mentioned this pull requestMay 9, 2025
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

@timhoffmtimhoffmtimhoffm approved these changes

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

Successfully merging this pull request may close these issues.

[MNT]: Draggable legend gets stuck on cursor after scroll event
3 participants
@dstansby@timhoffm@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp