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

Error on zoom near of border #7

Closed aluismarte closed 4 years ago

aluismarte commented 4 years ago

Everithing work fantastic, but when i put a point near of a border, give a distortion when i do zoom in or zoom out

    val config =
        MapViewConfiguration(8, 24000, 22000, 256, tileStreamProvider)
            .setMaxScale(1.2f)
            .setWorkerCount(4)
            .setPadding(256)
            .setMagnifyingFactor(0)
            .setMinimumScaleMode(MinimumScaleMode.FILL)

mpMap.defineBounds(0.0, 120.0, 100.0, 0.0)

point on 71.09375, 91.78125 (near of a border)

Error on zoom out error-part-1 Error-part-3

zoom in and error show it Real position of point error-part-2

p-lr commented 4 years ago

By default, the MapView positions markers so that the fix point is at the bottom-center of the marker. I believe that in your case, you want the center of the marker to be at (50.0, 60.0). Then, you should add the marker using:

addMarker(marker, x, y, relativeAnchorLeft = -0.5f, relativeAnchorTop = -0.5f)
aluismarte commented 4 years ago

Yes!, thanks! is fix