Skip to content

Commit 9e77036

Browse files
committed
Don't set zoom/pan cursor for non-navigatable axes.
Zoom/pan cannot be used e.g. on colorbars, which are "non-navigatable". So don't set the zoom/pan cursor when the mouse is over them, either.
1 parent 84ff954 commit 9e77036

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2976,7 +2976,7 @@ def _update_cursor(self, event):
29762976
"""
29772977
Update the cursor after a mouse move event or a tool (de)activation.
29782978
"""
2979-
if self.mode and event.inaxes:
2979+
if self.mode and event.inaxes and event.inaxes.get_navigate():
29802980
if (self.mode == _Mode.ZOOM
29812981
and self._lastCursor != cursors.SELECT_REGION):
29822982
self.set_cursor(cursors.SELECT_REGION)

lib/matplotlib/backend_tools.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ def _add_tool_cbk(self, event):
262262
def _set_cursor_cbk(self, event):
263263
if not event:
264264
return
265-
if self._current_tool and getattr(event, "inaxes", None):
265+
if (self._current_tool and getattr(event, "inaxes", None)
266+
and event.inaxes.get_navigate()):
266267
if self._last_cursor != self._current_tool.cursor:
267268
self.set_cursor(self._current_tool.cursor)
268269
self._last_cursor = self._current_tool.cursor

0 commit comments

Comments
 (0)