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

Skip to content

Commit bb47e26

Browse files
Fix new 3d pan/zoom view going on view stack twice
1 parent 039b975 commit bb47e26

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import matplotlib.transforms as mtransforms
3232
from matplotlib.axes import Axes
3333
from matplotlib.axes._base import _axis_method_wrapper, _process_plot_format
34+
from matplotlib.backend_bases import _Mode
3435
from matplotlib.transforms import Bbox
3536
from matplotlib.tri.triangulation import Triangulation
3637

@@ -1011,7 +1012,7 @@ def _button_press(self, event):
10111012
def _button_release(self, event):
10121013
self.button_pressed = None
10131014
toolbar = getattr(self.figure.canvas, "toolbar")
1014-
if toolbar:
1015+
if toolbar and toolbar.mode not in (_Mode.PAN, _Mode.ZOOM):
10151016
self.figure.canvas.toolbar.push_current()
10161017

10171018
def _get_view(self):
@@ -1231,10 +1232,6 @@ def _set_view_from_bbox(self, bbox, direction='in',
12311232
scale_u = dx / (self.bbox.max[0] - self.bbox.min[0])
12321233
scale_v = dy / (self.bbox.max[1] - self.bbox.min[1])
12331234

1234-
# Limit box zoom to reasonable range, protect for divide by zero below
1235-
scale_u = np.clip(scale_u, 1e-2, 1)
1236-
scale_v = np.clip(scale_v, 1e-2, 1)
1237-
12381235
# Keep aspect ratios equal
12391236
scale = max(scale_u, scale_v)
12401237

0 commit comments

Comments
 (0)