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

Appearance settings

Commit 5729cb5

Browse filesBrowse files
authored
Merge pull request #18444 from QuLogic/nbagg-doubleclick
Support doubleclick in webagg/nbagg
2 parents e1526d1 + 106cb6d commit 5729cb5
Copy full SHA for 5729cb5

File tree

Expand file treeCollapse file tree

3 files changed

+10
-6
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+10
-6
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,9 +1411,6 @@ class MouseEvent(LocationEvent):
14111411
----------
14121412
button : None or `MouseButton` or {'up', 'down'}
14131413
The button pressed. 'up' and 'down' are used for scroll events.
1414-
Note that in the nbagg backend, both the middle and right clicks
1415-
return RIGHT since right clicking will bring up the context menu in
1416-
some browsers.
14171414
Note that LEFT and RIGHT actually refer to the "primary" and
14181415
"secondary" buttons, i.e. if the user inverts their left and right
14191416
buttons ("left-handed setting") then the LEFT button will be the one

‎lib/matplotlib/backends/backend_webagg_core.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_webagg_core.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ def _handle_mouse(self, event):
264264
guiEvent = event.get('guiEvent', None)
265265
if e_type == 'button_press':
266266
self.button_press_event(x, y, button, guiEvent=guiEvent)
267+
elif e_type == 'dblclick':
268+
self.button_press_event(x, y, button, dblclick=True,
269+
guiEvent=guiEvent)
267270
elif e_type == 'button_release':
268271
self.button_release_event(x, y, button, guiEvent=guiEvent)
269272
elif e_type == 'motion_notify':
@@ -274,9 +277,9 @@ def _handle_mouse(self, event):
274277
self.leave_notify_event()
275278
elif e_type == 'scroll':
276279
self.scroll_event(x, y, event['step'], guiEvent=guiEvent)
277-
handle_button_press = handle_button_release = handle_motion_notify = \
278-
handle_figure_enter = handle_figure_leave = handle_scroll = \
279-
_handle_mouse
280+
handle_button_press = handle_button_release = handle_dblclick = \
281+
handle_figure_enter = handle_figure_leave = handle_motion_notify = \
282+
handle_scroll = _handle_mouse
280283

281284
def _handle_key(self, event):
282285
key = _handle_key(event['key'])

‎lib/matplotlib/backends/web_backend/js/mpl.js

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/web_backend/js/mpl.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ mpl.figure.prototype._init_canvas = function () {
238238
'mouseup',
239239
on_mouse_event_closure('button_release')
240240
);
241+
rubberband_canvas.addEventListener(
242+
'dblclick',
243+
on_mouse_event_closure('dblclick')
244+
);
241245
// Throttle sequential mouse events to 1 every 20ms.
242246
rubberband_canvas.addEventListener(
243247
'mousemove',

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.