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 d1516e6

Browse filesBrowse files
committed
Fix cursor restoration.
1 parent 54689d7 commit d1516e6
Copy full SHA for d1516e6

File tree

4 files changed

+9
-9
lines changed
Filter options

4 files changed

+9
-9
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2818,7 +2818,8 @@ def __init__(self, canvas):
28182818
self._idPress = None
28192819
self._idRelease = None
28202820
self._active = None
2821-
self._lastCursor = None
2821+
# This cursor will be set after the initial draw.
2822+
self._lastCursor = cursors.POINTER
28222823
self._init_toolbar()
28232824
self._idDrag = self.canvas.mpl_connect(
28242825
'motion_notify_event', self.mouse_move)
@@ -2904,14 +2905,13 @@ def _set_cursor(self, event):
29042905
self.set_cursor(cursors.POINTER)
29052906
self._lastCursor = cursors.POINTER
29062907
else:
2907-
if self._active == 'ZOOM':
2908-
if self._lastCursor != cursors.SELECT_REGION:
2909-
self.set_cursor(cursors.SELECT_REGION)
2910-
self._lastCursor = cursors.SELECT_REGION
2908+
if (self._active == 'ZOOM'
2909+
and self._lastCursor != cursors.SELECT_REGION):
2910+
self.set_cursor(cursors.SELECT_REGION)
2911+
self._lastCursor = cursors.SELECT_REGION
29112912
elif (self._active == 'PAN' and
29122913
self._lastCursor != cursors.MOVE):
29132914
self.set_cursor(cursors.MOVE)
2914-
29152915
self._lastCursor = cursors.MOVE
29162916

29172917
def mouse_move(self, event):

‎lib/matplotlib/backends/backend_agg.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_agg.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def draw(self):
429429
self.figure.draw(self.renderer)
430430
finally:
431431
if toolbar:
432-
toolbar.set_cursor(cursors.POINTER)
432+
toolbar.set_cursor(toolbar._lastCursor)
433433
RendererAgg.lock.release()
434434

435435
def get_renderer(self, cleared=False):

‎lib/matplotlib/backends/backend_gtk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def expose_event(self, widget, event):
400400
self.window.draw_drawable (self.style.fg_gc[self.state],
401401
self._pixmap, x, y, x, y, w, h)
402402
if toolbar:
403-
toolbar.set_cursor(cursors.POINTER)
403+
toolbar.set_cursor(toolbar._lastCursor)
404404
return False # finish event propagation?
405405

406406
filetypes = FigureCanvasBase.filetypes.copy()

‎lib/matplotlib/backends/backend_gtk3cairo.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk3cairo.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def on_draw_event(self, widget, ctx):
4444
x, y, w, h = allocation.x, allocation.y, allocation.width, allocation.height
4545
self._render_figure(w, h)
4646
if toolbar:
47-
toolbar.set_cursor(cursors.POINTER)
47+
toolbar.set_cursor(toolbar._lastCursor)
4848
return False # finish event propagation?
4949

5050

0 commit comments

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