-
Notifications
You must be signed in to change notification settings - Fork 20
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
Undesired scroll behavior at lower scale ratios after device rotation #122
Comments
Could you reproduce the behavior you describe in a fork of the demo app?
It will be easier to investigate.
Le ven. 8 nov. 2024, 20:08, Ryan W. ***@***.***> a écrit :
… I've initialized MapState with a scale of 0f for a tile map to ensure the
initial view displays the entire map. It uses the default
MinimumScaleMode.Fit. However, after rotating the device, the tile map
shifts either to the left or top, depending on whether the initial
orientation was portrait or landscape.
I believe this shift occurs due to how SetScroll is recalculated within
ZoomPanRotateState.onSizeChanged.
https://github.com/p-lr/MapCompose/blob/dd015ac4c1e8588cd41e6edec24defb8e27c1da5/mapcompose/src/main/java/ovh/plrapps/mapcompose/ui/state/ZoomPanRotateState.kt#L538
—
Reply to this email directly, view it on GitHub
<#122>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADXKCCVYJZ4NAWGSL6HLH6DZ7UD2DAVCNFSM6AAAAABRODOB3KVHI2DSMVQWIX3LMV43ASLTON2WKOZSGY2DIOJRHAZDEMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
You can see the issue by pinch zooming out completely on a any of the charts in the demo. But for brevity I set the scale for the simple map to 0 in this cloned branch. You can see the behavior after rotating the device right 90 degrees and then back. It doesn't maintain the center when the scale < 1. |
I could reproduce the issue, thanks. I'll look into this. |
You were right, the problem was indeed in |
Thanks. When do you plan to include this commit in a new release? |
The version 2.12.12 is being published. |
I've initialized MapState with a scale of 0f for a tile map to ensure the initial view displays the entire map. It uses the default MinimumScaleMode.Fit. After rotating the device, the tile map shifts either to the left or top, depending on whether the initial orientation was portrait or landscape, thus failing to maintain the center of the image.
I believe this shift occurs due to how SetScroll is recalculated within ZoomPanRotateState.onSizeChanged. On larger scale ratios, the center of the image is maintained after device rotation as the code is intended. It looks as if the calculations aren't friendly for scales < 1.
MapCompose/mapcompose/src/main/java/ovh/plrapps/mapcompose/ui/state/ZoomPanRotateState.kt
Line 538 in dd015ac
The text was updated successfully, but these errors were encountered: