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

Allow images to be moved around the cropper area when zoom is less than 1 #52

Merged
merged 4 commits into from
Jan 15, 2024

Conversation

drijnkels
Copy link
Contributor

I'm not sure if this is a feature you're looking for in this package, but it has been useful in projects before. Feel free to reject.

Currently when zoom goes below 1 and the image becomes smaller than the cropper area the image stays glued to the top left corner of the cropper area. This update will make it so that when zoom drops below 1 the image can be moved around in the cropper area but no part of the image can be outside of it.

Where does this idea come from? When letting users upload logos, that will be displayed in a round avatar, in a SaaS product it can be useful to let users resize the logo smaller than the cropper area to fit more nicely in the round avatar.

@ValentinH
Copy link
Owner

Thanks for this, it's indeed a nice feature! I think it will be worth backporting it to the parent. React lib.

src/lib/Cropper.svelte Outdated Show resolved Hide resolved
@drijnkels
Copy link
Contributor Author

Thanks for the feedback, I moved the code and updated the +page.svelte so that it can be tested. Let me know if you have any comments!

Copy link
Owner

@ValentinH ValentinH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thanks!

@ValentinH ValentinH merged commit edb1d6c into ValentinH:main Jan 15, 2024
1 check passed
@ValentinH
Copy link
Owner

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.

None yet

2 participants