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

Skip to content

Commit f54d0ed

Browse files
committed
Add note about nbagg middle click button
In nbagg backend right now, MouseEvent.button maps to 3 for both middle clicks and right clicks. Added a note about this in MouseEvent docstring. Closes #4289 for now. Change-Id: I1a191382191087ebb9072626c9f4dfb59c519d89
1 parent 9348a46 commit f54d0ed

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/matplotlib/backend_bases.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
:class:`Event`
1717
The base class for all of the matplotlib event
18-
handling. Derived classes suh as :class:`KeyEvent` and
18+
handling. Derived classes such as :class:`KeyEvent` and
1919
:class:`MouseEvent` store the meta data like keys and buttons
2020
pressed, x and y locations in pixel and
2121
:class:`~matplotlib.axes.Axes` coordinates.
@@ -1499,7 +1499,9 @@ class MouseEvent(LocationEvent):
14991499
15001500
*button*
15011501
button pressed None, 1, 2, 3, 'up', 'down' (up and down are used
1502-
for scroll events)
1502+
for scroll events). Note that in the nbagg backend, both the
1503+
middle and right clicks return 3 since right clicking will bring
1504+
up the context menu in some browsers.
15031505
15041506
*key*
15051507
the key depressed when the mouse event triggered (see

lib/matplotlib/backends/backend_webagg_core.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,8 @@ def handle_event(self, event):
296296
# The right mouse button pops up a context menu, which
297297
# doesn't work very well, so use the middle mouse button
298298
# instead. It doesn't seem that it's possible to disable
299-
# the context menu in recent versions of Chrome.
299+
# the context menu in recent versions of Chrome. If this
300+
# is resolved, please also adjust the docstring in MouseEvent.
300301
if button == 2:
301302
button = 3
302303

0 commit comments

Comments
 (0)