Nothing Special   »   [go: up one dir, main page]

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

Undesired scroll behavior at lower scale ratios after device rotation #122

Closed
algostrat opened this issue Nov 8, 2024 · 6 comments
Closed
Labels
bug Something isn't working

Comments

@algostrat
Copy link
algostrat commented Nov 8, 2024

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.

@p-lr
Copy link
Owner
p-lr commented Nov 8, 2024 via email

@algostrat
Copy link
Author
algostrat commented Nov 13, 2024

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.

Initial (Portrait)
Initial

Rotate clockwise 90 degrees
Rotate right 90 degrees

Rotate counter clockwise 90 degrees
Rotate left 90 degrees

@p-lr
Copy link
Owner
p-lr commented Nov 13, 2024

I could reproduce the issue, thanks. I'll look into this.

@p-lr p-lr added the bug Something isn't working label Nov 13, 2024
@p-lr p-lr closed this as completed in 7219b48 Nov 13, 2024
@p-lr
Copy link
Owner
p-lr commented Nov 13, 2024

You were right, the problem was indeed in ZoomPanRotateState.onSizeChanged()

@algostrat
Copy link
Author

You were right, the problem was indeed in ZoomPanRotateState.onSizeChanged()

Thanks. When do you plan to include this commit in a new release?

@p-lr
Copy link
Owner
p-lr commented Nov 14, 2024

The version 2.12.12 is being published.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants