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

restrictPosition wrong on zoom<1 #581

Open
svaraborut opened this issue Jan 18, 2025 · 3 comments
Open

restrictPosition wrong on zoom<1 #581

svaraborut opened this issue Jan 18, 2025 · 3 comments
Labels
bug Something isn't working PR-welcome help is welcomed for this issue

Comments

@svaraborut
Copy link

Describe the bug
When restrictPosition is set to true and the zoom is negative the position restriction does not adhere to the documentation which claims "media should be restricted to the boundaries of the cropper". The short axis is stuck to 0 rather than moving freely on the available space.

Expected behavior
The image should move freely within this boundaries

Image
@ValentinH
Copy link
Owner

This is a good point, this is an edge case but it should not work like this.

To be honest, I don't have much bandwidth for this project at the moment so I can't commit on a date to work on this.

However, if someone wants to work on a fix, I can review and merge it.

@ValentinH ValentinH added bug Something isn't working PR-welcome help is welcomed for this issue labels Jan 18, 2025
@svaraborut
Copy link
Author

svaraborut commented Jan 18, 2025

Upon further investigation also croppedAreaPixels from onCropComplete is broken under restrictPosition with negative zoom. width and height will never exceed the image's natural size. This causes improper cropping of the image.

This is also broken when zoom=1 but rotation is applied again due to improper bounding of the crop area.

@svaraborut
Copy link
Author

I will have to fix it somehow before going to production. I will try to create a PR by then 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR-welcome help is welcomed for this issue
Projects
None yet
Development

No branches or pull requests

2 participants