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

Skip to content

Commit 6e0b7e6

Browse files
committed
change cursor inmediately after toggle
1 parent 9d3c977 commit 6e0b7e6

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

lib/matplotlib/backend_bases.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3434,6 +3434,9 @@ def _handle_toggle(self, name, event=None, from_toolbar=False):
34343434
for a in self.canvas.figure.get_axes():
34353435
a.set_navigate_mode(self._toggled)
34363436

3437+
# Change the cursor inmediately, don't wait for mouse move
3438+
self._set_cursor(event)
3439+
34373440
def get_tools(self):
34383441
"""Return the tools controlled by `Navigation`"""
34393442

@@ -3446,7 +3449,10 @@ def get_tools(self):
34463449
'keymap': keys}
34473450
return d
34483451

3449-
def _mouse_move(self, event):
3452+
def _set_cursor(self, event):
3453+
"""Call the backend specific set_cursor method,
3454+
if the pointer is inaxes
3455+
"""
34503456
if not event.inaxes or not self._toggled:
34513457
if self._last_cursor != self._default_cursor:
34523458
self.set_cursor(self._default_cursor)
@@ -3458,6 +3464,9 @@ def _mouse_move(self, event):
34583464
self.set_cursor(cursor)
34593465
self._last_cursor = cursor
34603466

3467+
def _mouse_move(self, event):
3468+
self._set_cursor(event)
3469+
34613470
if self.toolbar is None or self.messagelock.locked():
34623471
return
34633472

0 commit comments

Comments
 (0)