-
Notifications
You must be signed in to change notification settings - Fork 29
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
Make initial state setup #3
Comments
Thanks for the suggestion. In the meantime you can do something like this val cropState = imageCropper.cropState
LaunchedEffect(key = cropState != null) {
cropState?.let { state ->
state.shape = TriangleCropShape
state.aspectLock = true
}
}
//.....
if (cropState != null) ImageCropperDialog(state = cropState) Which would allow you change anything you want and would only be called once before the crop dialog is shown |
Hope this coming soon. And give you a big thanks for the plugin |
Hi! I'm using your library to implement a profile picture cropping feature. Ideally, I'd like to simplify the cropping experience for the user by limiting the options to a square crop with a fixed 1:1 aspect ratio. I understand that the CropState constructor is not currently public, but I'm wondering if there could be a way to achieve this in a future release. Perhaps a parameter in the ImageCropper::crop function to set the initial aspect ratio and lock it, or a way to pass a custom CropState instance with the desired configuration. This would greatly enhance the usability for profile picture cropping, as the only action required from the user would be to position and size the square cropping area. Thanks again for your help and for developing this useful library! |
You can configure your LaunchedEffect(cropState) {
cropState?.let { state ->
state.shape = // Your impl. of a square shape
state.region = state.region.setAspect(1f)
}
}
// Prevent users from disabling aspect lock since we can't hide the aspect selection UI
LaunchedEffect(cropState?.aspectLock) {
cropState?.aspectLock = true
} |
Thank you! I get --> Unresolved reference: setAspect on state.region.setAspect(1f) |
I copied from here and kept public for my usage. |
Hey, thanks again for the code snippet and the link. I really appreciate your help! Unfortunately, I'm still getting an "Unresolved reference: setAspect" error when I try to implement the function. I've tried defining the function in my file and importing it from an external library, but I'm still having trouble. Could you take a look at my code and see if you can spot what I'm doing wrong?Here's the relevant part of my code:
|
Hi,
|
Hi there, cool library! Thanks for that.
For my use case would be super nice to have initial state setup before actually presenting the dialog.
Basically what I need in method
CropState
put my custom properties:Or maybe having separate data class with initial values, then it could be used in reset function as well.
The text was updated successfully, but these errors were encountered: