Open distivi opened 1 year ago
Thanks for the suggestion.
Currently, the CropState constuctor function is not part of the public api, also ImageCropper creates the instance internally. I guess in a future release you would have the option to pass your own CropState to ImageCropper::crop
.
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 that helps !
Thanks for the suggestion. Currently, the CropState constuctor function is not part of the public api, also ImageCropper creates the instance internally. I guess in a future release you would have the option to pass your own CropState to
ImageCropper::crop
.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 that helps !
Hope this coming soon. And give you a big thanks for the plugin
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.