-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow disabling specific mouse actions in blocking_input #12199
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow disabling specific mouse actions in blocking_input #12199
Conversation
ginput doesn´t allow to disable buttons. With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan. Updated the documentation associated with ginput, regarding the changes applied to blocking_input to allow for pan and zoom (PR cleanup by the committer.)
98767df
to
7c24848
Compare
lib/matplotlib/figure.py
Outdated
points, terminating the inputs) can be overridden via the arguments | ||
*mouse_add*, *mouse_pop* and *mouse_stop*, that set the associated | ||
mouse button: 1 for left, 2 for middle, 3 for right. Using a different | ||
value (e.g. None) disables the corresponding mouse action. |
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.
We should be stricter about the guaranteed behavior: "Passing None disables the corresponding mouse action."
Other values should have undefined behavior, or better be rejected with a ValueError. I could for example imagine that we allow 'left', 'middle', 'right' instead of 1, 2, 3 in the future, which would be a more readable API. That would be a breaking API change with the above laissez-faire definition.
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.
I'd rather not change the behavior in this PR (other than the check for botton_add which is clearly correct). Feel free to push changes to the docstring as you see fit.
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.
Ok. I've updated the docstring.
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.
looks good to me
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.
I approve the code change, but since I modified the docs, I won't merge this myself.
lib/matplotlib/figure.py
Outdated
- Remove the most recently added point. | ||
- Stop the interaction and return the points added so far. | ||
|
||
The actions are assigned to mouse buttons via the the arguments |
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.
Two 'the's.
f07b7cb
to
5f29877
Compare
This is #11661 taking into account @timhoffm's comment and fixing the docs. Thanks to @saksmito for the PR.
ginput doesn´t allow to disable buttons.
With this change you can assign an invalid button to the three mouse buttons and leave the left click empty to zoom or pan.
Updated the documentation associated with ginput, regarding the changes applied to blocking_input to allow for pan and zoom
(PR cleanup by the committer.)
PR Summary
PR Checklist