Skip to content

Conversation

@jeromeetienne
Copy link
Contributor

@jeromeetienne jeromeetienne commented Sep 17, 2025

add .update() in_scroll function, thus the caller can know if the camera zoom moved.

Similar to the on_motion() function

It is useful when the caller is processing depending on the distance-to-camera for examples

add .update() in_scroll function, thus the caller can know if the camera zoom moved
@rougier
Copy link
Owner

rougier commented Sep 17, 2025

But the zoom implementation on matplotlib is a trick. I modify viewport limits (instead of -1/+1 set it to -1+delta/+1+delta. This avoids to recompute everything (it works only for zoom). Said differrently, this is a fake camera zoom but good enough.

There is not implementation of an actual camera zoom in the matplotlib implementation even though all necessary functions are here.

@jeromeetienne
Copy link
Contributor Author

@rougier the camera.zoom is changing appropriatly, meaning it goes from .zoom_min to .zoom_max

so it provides valid z coordinates which can used in the .update() function to compute the size of Points for examples

Or to change the alpha of a color to simulate a fog

Currently the caller can not be notified when the zoom is changing, thus it can not update the point size or the color alpha.

@jeromeetienne
Copy link
Contributor Author

jeromeetienne commented Sep 17, 2025

If you prefere i can provide a PR which has .update() functions per event type ? scroll/click/press/motion

like you did here 😃

@rougier
Copy link
Owner

rougier commented Sep 17, 2025

The points 3D example does just that.

@jeromeetienne
Copy link
Contributor Author

@rougier cest ok si je backport la camera de gsp examples ici ?

@rougier
Copy link
Owner

rougier commented Sep 17, 2025

I did not realize I was on matplotlib-3d repository. Why do you want to change here (instead of GSP) ?

@jeromeetienne
Copy link
Contributor Author

@rougier im using this library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants