Thanks to visit codestin.com
Credit goes to github.com

Skip to content

allow webAgg to report middle click events #18172

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

Merged
merged 3 commits into from
Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions doc/api/next_api_changes/behavior/18172-IHI.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
webAgg backend no longer reports a middle click as a right click
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Previously when using the webAgg backend the event passed to a callback
by ``fig.canvas.mpl_connect('mouse_button_event', callback)`` on a middle click
would report `.MouseButton.RIGHT` instead of `.MouseButton.MIDDLE`
8 changes: 0 additions & 8 deletions lib/matplotlib/backends/backend_webagg_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,14 +260,6 @@ def _handle_mouse(self, event):
# off by 1
button = event['button'] + 1

# The right mouse button pops up a context menu, which
# doesn't work very well, so use the middle mouse button
# instead. It doesn't seem that it's possible to disable
# the context menu in recent versions of Chrome. If this
# is resolved, please also adjust the docstring in MouseEvent.
if button == 2:
button = 3

e_type = event['type']
guiEvent = event.get('guiEvent', None)
if e_type == 'button_press':
Expand Down