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

Restore rotation and cropRect #589

Open
rbuiten opened this issue Aug 15, 2023 · 3 comments
Open

Restore rotation and cropRect #589

rbuiten opened this issue Aug 15, 2023 · 3 comments

Comments

@rbuiten
Copy link

rbuiten commented Aug 15, 2023

hello,

I am working on your beautiful library but I do have some challenges to reset the cropRect and rotation correctly. The use case is that user can select multiple images at once. Then our own activity is loaded and we added the image cropper view to it. And from each image they can update the rotation and change the crop. So, we are saving the cropRect we do receive at the setOnSetCropOverlayReleasedListener. After selecting the image (we use the setImageUriAsync for this), the cropRect function will be called within the setOnSetImageUriCompleteListener. After setting the cropRect we are rotating the image. This does work for landscape images, but with portrait images the cropRect isn't on the right place.

What should I do to restore the rotation and cropRect. I did try several things but it doesn't work to have it on the exact same place.

To have it more clear, here is the code

 binding.image.setOnSetCropOverlayReleasedListener { rect ->
            activatedImage?.let {
                if (enableCropListener && rect != null) {
                    presenter.onImageCropUpdated(it, rect)
                }
            }
        }
        binding.image.setOnSetImageUriCompleteListener { view, _, _ ->
            activatedImage?.let {
                enableCropListener = false

                binding.image.cropRect = it.croppedImage
                binding.image.rotateImage(it.degrees)

                enableCropListener = true
            }
        }

we do load the image with

binding.image.setImageUriAsync(it.originalUri.toUri())        
@vanniktech
Copy link
Contributor

Might be a limitation that we don't support this.

@kenslee-studio
Copy link

@rbuiten @vanniktech Looking closely to the rect values , I have found that it is giving wrong values for photo in portrait mode. Might be some problem with the code

@sandeepyohans
Copy link

Hi team, any update on this issue? Is it fixed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants