diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index 14a94a744cce..ea901c671192 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -79,7 +79,6 @@ def __init__( if rect is None: rect = [0.0, 0.0, 1.0, 1.0] - self._cids = [] self.initial_azim = azim self.initial_elev = elev @@ -115,6 +114,12 @@ def __init__( self._zcid = None self.mouse_init() + self.figure.canvas.mpl_connect( + 'motion_notify_event', self._on_move), + self.figure.canvas.mpl_connect( + 'button_press_event', self._button_press), + self.figure.canvas.mpl_connect( + 'button_release_event', self._button_release), self.set_top_view() self.patch.set_linewidth(0) @@ -1004,8 +1009,7 @@ def get_proj(self): def mouse_init(self, rotate_btn=1, zoom_btn=3): """ - Initializes mouse button callbacks to enable 3D rotation of the axes. - Also optionally sets the mouse buttons for 3D rotation and zooming. + Set the mouse buttons for 3D rotation and zooming. Parameters ---------- @@ -1015,20 +1019,16 @@ def mouse_init(self, rotate_btn=1, zoom_btn=3): The mouse button or buttons to use to zoom the 3D axes. """ self.button_pressed = None - self._cids = [ - self.figure.canvas.mpl_connect( - 'motion_notify_event', self._on_move), - self.figure.canvas.mpl_connect( - 'button_press_event', self._button_press), - self.figure.canvas.mpl_connect( - 'button_release_event', self._button_release), - ] # coerce scalars into array-like, then convert into # a regular list to avoid comparisons against None # which breaks in recent versions of numpy. self._rotate_btn = np.atleast_1d(rotate_btn).tolist() self._zoom_btn = np.atleast_1d(zoom_btn).tolist() + def disable_mouse_rotation(self): + """Disable mouse buttons for 3D rotation and zooming.""" + self.mouse_init(rotate_btn=[], zoom_btn=[]) + def can_zoom(self): """ Return *True* if this axes supports the zoom box button functionality. @@ -1069,13 +1069,6 @@ def cla(self): self.grid(rcParams['axes3d.grid']) - def disable_mouse_rotation(self): - """Disable mouse button callbacks.""" - # Disconnect the various events we set. - for cid in self._cids: - self.figure.canvas.mpl_disconnect(cid) - self._cids = [] - def _button_press(self, event): if event.inaxes == self: self.button_pressed = event.button pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy