From 846b8eacec01aef7f87dab288fcf1063012b72bb Mon Sep 17 00:00:00 2001 From: ianhi Date: Tue, 4 Aug 2020 16:50:35 -0400 Subject: [PATCH 1/3] allow webAgg to report middle click events The current MouseEvent docstring has no mention of this issue so I did not remove anything there. This code was originally added to account for difficulties in preventing the context menu in chrome 23 https://github.com/matplotlib/matplotlib/pull/1426#discussion_r1915509 --- lib/matplotlib/backends/backend_webagg_core.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/lib/matplotlib/backends/backend_webagg_core.py b/lib/matplotlib/backends/backend_webagg_core.py index 2155381fbd77..20a5676c4bf1 100644 --- a/lib/matplotlib/backends/backend_webagg_core.py +++ b/lib/matplotlib/backends/backend_webagg_core.py @@ -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': From d34d0fd840cbbaef87b725dd164d3caaa318a801 Mon Sep 17 00:00:00 2001 From: ianhi Date: Tue, 4 Aug 2020 19:03:49 -0400 Subject: [PATCH 2/3] DOC: add api change note --- doc/api/next_api_changes/behavior/18172-IHI.rst | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 doc/api/next_api_changes/behavior/18172-IHI.rst diff --git a/doc/api/next_api_changes/behavior/18172-IHI.rst b/doc/api/next_api_changes/behavior/18172-IHI.rst new file mode 100644 index 000000000000..45cbdfd5a5cf --- /dev/null +++ b/doc/api/next_api_changes/behavior/18172-IHI.rst @@ -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` From ce8d715c59623f4b16fb669f98564854b5d43357 Mon Sep 17 00:00:00 2001 From: Ian Hunt-Isaak Date: Tue, 4 Aug 2020 20:18:54 -0400 Subject: [PATCH 3/3] correct api note formatting Co-authored-by: Elliott Sales de Andrade --- doc/api/next_api_changes/behavior/18172-IHI.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/next_api_changes/behavior/18172-IHI.rst b/doc/api/next_api_changes/behavior/18172-IHI.rst index 45cbdfd5a5cf..6a88acbeb71a 100644 --- a/doc/api/next_api_changes/behavior/18172-IHI.rst +++ b/doc/api/next_api_changes/behavior/18172-IHI.rst @@ -1,6 +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` +by ``fig.canvas.mpl_connect('mouse_button_event', callback)`` on a middle click +would report `.MouseButton.RIGHT` instead of `.MouseButton.MIDDLE`