Skip to content

Commit 3ee98fd

Browse files
committed
Still require toolbar for interactive navigation
1 parent f5ba730 commit 3ee98fd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2582,12 +2582,18 @@ def scroll_handler(event, canvas=None, toolbar=None):
25822582
# zooming is currently only supported on rectilinear axes
25832583
return
25842584

2585-
if event.key == "control": # zoom towards the mouse position
2586-
if toolbar is None:
2587-
toolbar = (canvas or event.canvas).toolbar
2585+
if toolbar is None:
2586+
toolbar = (canvas or event.canvas).toolbar
2587+
2588+
if toolbar is None:
2589+
# technically we do not need a toolbar, but until wheel zoom was
2590+
# introduced, any interactive modification was only possible through
2591+
# the toolbar tools. For now, we keep the restriction that a toolbar
2592+
# is required for interactive navigation.
2593+
return
25882594

2589-
if toolbar is not None:
2590-
toolbar.push_current() # update view history
2595+
if event.key == "control": # zoom towards the mouse position
2596+
toolbar.push_current()
25912597

25922598
xmin, xmax = ax.get_xlim()
25932599
ymin, ymax = ax.get_ylim()

0 commit comments

Comments
 (0)