p-lr / MapView

A Fast, memory efficient Android library to display tiled maps, with support for markers, paths, and rotation.
Apache License 2.0
184 stars 38 forks source link

Setting minimum scale mode and zooming below FILL equivalent gives scaling issues #47

Open az-faro opened 7 months ago

az-faro commented 7 months ago

When I use MapViewConfiguration.setMinimumScaleMode() with anything other than MinimumScaleMode.FILL and zoom out below where FILL would stop zooming in normal cases the scaling of the map goes crazy.

See example image of a drawing. Notice how the entire lower half of it is stretched to double size in the y axis. Similarly there is some stretching at the right edge of the image as well: bild

Another example, here we can see duplication in the lower and right part of the image with both correct and streched data shown at the same time: bild

Similarly I have noticed that when this happens the CoordinateTranslater.translateAndScaleAbsoluteToRelativeY() misbehaves and gives incorrect values.

As soon as you get back within the limits of FILL everything starts working correctly again.

p-lr commented 7 months ago

Thanks for describing in detail your issue. It would be ideal if you could reproduce your issue in a fork of the demo app, so I can investigate.

az-faro commented 4 months ago

Hello again, sorry for the delay, but I finally got around to reproduce this. I would say it's related to the tiles not always being the set size (if the source image isn't an even multiplier of the tile size, the edge tiles are smaller in my case). This was perfectly fine in TileView, but I guess it might be different here. See the reproduction: https://github.com/az-faro/MapView/tree/bugs/scaling-issues.

p-lr commented 4 months ago

I can see that some of your tiles aren't square. In your case, all tiles must be 512x512 px, because MapView does not support rectangular tiles.