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

Support image rotation #130

Open
gildor opened this issue Feb 13, 2025 · 2 comments
Open

Support image rotation #130

gildor opened this issue Feb 13, 2025 · 2 comments

Comments

@gildor
Copy link

gildor commented Feb 13, 2025

We plan to use Telephoto as a foundation for image cropper, but Telephoto doesn't support image rotation (for side change or horizon level adjustment).

Because zoom already supported, it would be beneficial to support also rotation angle on level of Zoomable.

In terms of API, would be nice to support Content Scale for rotated photos too (so if zoom beyond rotated image area is allowed or not).

Additionally it may be considered to also support optional gesture rotation (otherwise it could be hard to implement without conflict with pinch to zoom)

@saket
Copy link
Owner

saket commented Feb 16, 2025

I'd love to support this. Wanna help me out?

I'm not sure what the API should look like, but we could start with a ZoomableState#rotateBy() function. Rotation values can be recorded in GestureState. You're right that we'll also need to adjust the rotated content's scale to ensure it fits within its bounds.

Additionally it may be considered to also support optional gesture rotation (otherwise it could be hard to implement without conflict with pinch to zoom)

I agree -- I've been passively wanting to solve this for some time now (#26). The only blocker is the coerceWithinContentBounds() function used here. It currently uses the content's top-left coordinates as its pivot point, but to support rotations, it will need to be changed to the center.

@gildor
Copy link
Author

gildor commented Feb 16, 2025

Yes, our team would love to help with it, let us look into the code

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

No branches or pull requests

2 participants