X-Git-Url: http://gitweb.fperrin.net/?p=GpsPrune.git;a=blobdiff_plain;f=tim%2Fprune%2Fgui%2Fmap%2FMapTileCacher.java;h=366e1ad3b055731efd5487746aac66ea5b978f3d;hp=ea5b6fb769813d7e3c0b4700fc55698454dec2db;hb=112bb0c9b46894adca9a33ed8c99ea712b253185;hpb=54b9d8bc8f0025ccf97a67d9dd217ef1f9cf082f diff --git a/tim/prune/gui/map/MapTileCacher.java b/tim/prune/gui/map/MapTileCacher.java index ea5b6fb..366e1ad 100644 --- a/tim/prune/gui/map/MapTileCacher.java +++ b/tim/prune/gui/map/MapTileCacher.java @@ -30,7 +30,7 @@ public class MapTileCacher implements ImageObserver private MapTileConfig _tileConfig = null; /** Grid size */ - private static final int GRID_SIZE = 11; + private static final int GRID_SIZE = 15; /** max zoom level of map tiles */ private static final int MAX_TILE_ZOOM = 18; @@ -52,7 +52,10 @@ public class MapTileCacher implements ImageObserver */ public void centreMap(int inZoom, int inTileX, int inTileY) { - if (inZoom != _zoom) + int shift = Math.max(Math.abs(inTileX-_tileX), Math.abs(inTileY - _tileY)); + if (shift == 0) {return;} + // Clear cache if either zoom has changed or map has jumped too far + if (inZoom != _zoom || shift > GRID_SIZE/2) { _zoom = inZoom; clearAll();