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

Skip to content

Commit c103278

Browse files
committed
Merge pull request #3474 from fariza/change-cursor-inmediately
ENH : call set cursor on zoom/pan toggle
1 parent ff4932d commit c103278

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2458,9 +2458,11 @@ def key_press_handler(event, canvas, toolbar=None):
24582458
# pan mnemonic (default key 'p')
24592459
elif event.key in pan_keys:
24602460
toolbar.pan()
2461+
toolbar._set_cursor(event)
24612462
# zoom mnemonic (default key 'o')
24622463
elif event.key in zoom_keys:
24632464
toolbar.zoom()
2465+
toolbar._set_cursor(event)
24642466
# saving current figure (default key 's')
24652467
elif event.key in save_keys:
24662468
toolbar.save_figure()
@@ -2741,7 +2743,7 @@ class implementation.
27412743
"""
27422744
raise NotImplementedError
27432745

2744-
def mouse_move(self, event):
2746+
def _set_cursor(self, event):
27452747
if not event.inaxes or not self._active:
27462748
if self._lastCursor != cursors.POINTER:
27472749
self.set_cursor(cursors.POINTER)
@@ -2757,6 +2759,9 @@ def mouse_move(self, event):
27572759

27582760
self._lastCursor = cursors.MOVE
27592761

2762+
def mouse_move(self, event):
2763+
self._set_cursor(event)
2764+
27602765
if event.inaxes and event.inaxes.get_navigate():
27612766

27622767
try:

0 commit comments

Comments
 (0)