-
Notifications
You must be signed in to change notification settings - Fork 548
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
[QUESTION] Not clear how to programmatically rotate the (custom) child #257
Comments
The value expected on the controller is radians just like rotate method on Matrix4. |
Thanks, @renancaraujo – you know, I never did pay attention to radians, I guess now I'll have to go look it up. I do think that it should be possible to rotate the image programmatically without having to enable rotation for the user. For example, I want to add a button in an overlay to rotate the child by 90 degrees, but don't want the user doing arbitrary rotations manually – |
You can use custom child to show an |
Thanks for that response. With respect (and thanks for this component), that feels rather complicated for doing what the PhotoView is already designed to do – rotate a child widget. But maybe I don't appreciate the effort that that would take – I'll take a look. Selfishly, my reason for wanting PhotoView to allow it is that I am already using |
This is only a workaround, as I said previously:
|
I've submitted a pull request to add this ability, though it does seem that we differ on the whether or not programmatic rotation should be allowed when enableRotation is not enabled – in which case, I can use the fork no problem. Thanks again for the package, it's really helpful. |
Wow, was ready to prioritize this task, thanks for the PR. |
No problem – I think however there may be some downstream issues, that I'll look at later. For example, if the photo view is rotated programmatically, then manually adjusting the scale afterwards is causing the rotation to revert back to the initial rotation. |
Is it too much to ask you to add an example page for that in the example app? If not its ok, I work on that. |
No problem – I'll update PR #259 |
@renancaraujo – I've updated PR #259 again to fix an issue whereby manual scaling after programmatic rotation resulted in the child reverting to 0.0 rotation. This has simplified the fix altogether, doing away with the sub-class of PhotoViewControllerValue. In essence, allowing programmatic rotation requires just two things, always applying the current rotation value and ensuring that manual rotation gestures do not update the rotation unless |
Merged on 0.10.1 |
I'm wanting to allow the user to tap a button to rotate the photo view custom child by 90 degrees left or right by tapping a button, but they should not be able to rotate the image manually.
I found that I could not achieve this at all unless the photo view's
enableRotation
parameter is enabled. I had expected this to only relate to user actions.Secondly, it isn't clear how PhotoViewController's
rotation
value should be updated to perform the rotation. My initial thought was to add either 90 or 0.25 to the rotation value, but this resulted in a child that was not at right angles to the initial orientation. I was surprised to find that adding a value of 1.57 seemed to do what I wanted – but still wrong after many rotations.It would be useful to have an example that should how to rotate programmatically by a number of degrees.
The text was updated successfully, but these errors were encountered: