Skip to content

Conversation

@anntzer
Copy link
Contributor

@anntzer anntzer commented Dec 7, 2019

Always setup the 3d mouse rotate/zoom callbacks and don't store their
cids; instead, handle their disconnection by disabling all mouse buttons
(which has the same observable effect).

This is in preparation of restoring the pan/zoom callbacks upon
unpickling (#10843): after a pickle/unpickle cycle, even if we restore the
callbacks, we can't guarantee that the callback numeric ids will stay
the same, and so self._cids would become incorrect.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@WeatherGod
Copy link
Member

I am a little uneasy about this change. How does the regular 2d axes object handle this stuff? I am also realizing that it was possible to accidentally connect multiple sets of the same callbacks through repeated calls, which is technically "fixed" by this..

@anntzer
Copy link
Contributor Author

anntzer commented Dec 7, 2019

2d axes don't generate their own callbacks (they are completely ignorant of the callback system), they are set up by the canvas (more specifically, by the toolbar) and attached to the canvas object.
When unpickling, the figure is attached to a new canvas who may or may not have a toolbar, which again is in charge of the callbacks.

@timhoffm
Copy link
Member

timhoffm commented Mar 9, 2020

Please rebase so that Travis can run.

Always setup the 3d mouse rotate/zoom callbacks and don't store their
cids; instead, handle their disconnection by disabling all mouse buttons
(which has the same observable effect).

This is in preparation of restoring the pan/zoom callbacks upon
unpickling: after a pickle/unpickle cycle, even if we restore the
callbacks, we can't guarantee that the callback numeric ids will stay
the same, and so self._cids would become incorrect.
@anntzer
Copy link
Contributor Author

anntzer commented Mar 9, 2020

done

@timhoffm timhoffm added this to the v3.3.0 milestone Mar 9, 2020
@timhoffm timhoffm merged commit 2938c6f into matplotlib:master Mar 9, 2020
@anntzer anntzer deleted the 3dcb branch March 9, 2020 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants