moagrius / MapView

(Deprecated, prefer https://github.com/moagrius/TileView) Android widget roughly described as a hybrid between com.google.android.maps.MapView and iOS's CATiledLayer
http://moagrius.github.com/MapView/documentation
69 stars 35 forks source link

map doesn't redraw after scrolling if scale is greater than 1 #62

Closed jgregor5 closed 11 years ago

jgregor5 commented 11 years ago

I found a patch that works for me in an specific case, and I want to share it with you, MapView users.

I need to have max scales bigger than 1. When I patch both same lines in ZoomManager.java and ZoomPanLayout.java:

private double maxScale = 4;

everything works fine, but at some point, only when scale is greater than 1, the map tiles will not be drawn after scrolling the map.

I patched TileManager, adding invalidate() at the end, and this solved the problem:

void onRenderTaskPostExecute() {
    // set flag that we're done
    isRendering = false;
    // everything's been rendered, so get rid of the old tiles
    cleanup();
    // recurse - request another round of render - if the same intersections are discovered, recursion will end anyways
    requestRender();
    // notify anybody interested
    if ( renderListener != null ) {
        renderListener.onRenderComplete();
    }
    invalidate();
}
moagrius commented 11 years ago

This has been fixed in TileView (https://github.com/moagrius/TileView), which allows scale greater than 1.