MapCompose: setScrollOffsetRatio makes scrolling and zooming problematic
I’m using setScrollOffsetRatio() to get map padding as I was advised in #65 and, as I was also warned there, I’m having issues with zooming and scrolling when the map is fully (or nearly fully) zoomed out.
In all demonstration videos below I used setScrollOffsetRatio(0.5f, 0.5f). They are all captured on an emulator but I get the same behavior on a real device.
- When the map is fully zoomed out its scrolling is symmetrically constrained along the smaller layout dimension and unsymmetrically along the larger dimension. As can be seen in the video below, I can scroll the map half its size out of the screen horizontally in both directions, but vertically I can only do it at the bottom and not at the top.
- The video above also demonstrates an issue with
InitialValues.scroll(). There it was set toscroll(0.5, 0.5), which is meant to initially center the map, but it appears at the bottom of the screen instead. Setting it toscroll(0.0, 0.0, Offset(0f, 0f))(which is the default) actually centers the map. - When the map doesn’t fully cover the screen, zooming seems to center somewhere at the bottom instead of where the gesture is actually centered. In the next video I’m zooming precisely into the center of the screen, but instead the zoom centers on a point on the bottom edge of the map. I think that the map tries to first fill the screen (which is reasonable) and then zoom where the user wants, but there is some error in calculations and it ends up at the bottom edge instead. Such behavior is very inconvenient, it is present both when zooming with pinch and with double-tap-and-drag.
centerOnMarker()doesn’t actually place the marker in the center of the layout when the map is zoomed out. In the video below I used the default “Center on marker” demo but changed the scale to 0 and enabledscrollOffsetRatio.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 27 (27 by maintainers)
I’ve merged on master. Next I’ll see if I can fix #79 before publishing the new
2.4.0version.Ha… I knew it was too easy. When rotation is enabled along with
setScrollOffsetRatio(0.5f, 0.5f), rotating the map behaves strangely. Perhaps we should open a new issue for this specific case.@TimPushkin I need to finish some ongoing work before looking into this issue.
If you manage to solve these issues, that means you get a thorough understanding of the library (or at least the “view” part). And solving the first one is already a good sign!