Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the zoom and panning area #4

Closed
tad-lispy opened this issue Jun 24, 2022 · 2 comments
Closed

Limit the zoom and panning area #4

tad-lispy opened this issue Jun 24, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@tad-lispy
Copy link

Hi! Thanks for this useful plugin.

Is there a way to limit how much the camera can zoom in or out? Or how far it can pan away?

@johanhelsing
Copy link
Owner

johanhelsing commented Jul 12, 2022

Not currently, but it would probably be a useful feature to support.

Implementation-wise, we could just add two fields, max_scale and min_scale to the PanCam struct, and update the line here to use clamp instead of max:

projection.scale = (projection.scale * (1. + -scroll * 0.001)).max(0.00001);

Let me know if you want to have a go at it, or I might do it myself once I'm done with a couple of other projects.

Sorry for the slow response time.

@johanhelsing johanhelsing added the enhancement New feature or request label Jul 28, 2022
This was referenced Jul 28, 2022
@johanhelsing
Copy link
Owner

Since I implemented the zooming part of this, I created a new issue for the remaining panning/viewable area part. I wont be picking it up now, so feel free to have a go at it if you need the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants