fix issue 75

git-svn-id: https://osmand.googlecode.com/svn/trunk@547 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-10-09 12:51:25 +00:00
parent e0f7f09a10
commit fe4ee9009e
2 changed files with 22 additions and 3 deletions

View file

@ -315,10 +315,12 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
ZoomControls zoomControls = (ZoomControls) findViewById(R.id.ZoomControls);
final ZoomControls zoomControls = (ZoomControls) findViewById(R.id.ZoomControls);
zoomControls.setOnZoomInClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
zoomControls.setIsZoomInEnabled(mapView.getZoom() + 1 < mapView.getMaximumShownMapZoom());
zoomControls.setIsZoomOutEnabled(mapView.getZoom() + 1 > mapView.getMinimumShownMapZoom());
mapView.getAnimatedDraggingThread().stopAnimatingSync();
mapView.getAnimatedDraggingThread().startZooming(mapView.getZoom(), mapView.getZoom() + 1);
showAndHideMapPosition();
@ -331,6 +333,8 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
zoomControls.setOnZoomOutClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
zoomControls.setIsZoomInEnabled(mapView.getZoom() - 1 < mapView.getMaximumShownMapZoom());
zoomControls.setIsZoomOutEnabled(mapView.getZoom() - 1 > mapView.getMinimumShownMapZoom());
mapView.getAnimatedDraggingThread().stopAnimatingSync();
mapView.getAnimatedDraggingThread().startZooming(mapView.getZoom(), mapView.getZoom() - 1);
showAndHideMapPosition();

View file

@ -247,10 +247,25 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
public float getYTile() {
return (float) MapUtils.getTileNumberY(getZoom(), latitude);
}
public int getMaximumShownMapZoom(){
if(map == null){
return 21;
} else {
return map.getMaximumZoomSupported() + OVERZOOM_IN;
}
}
public int getMinimumShownMapZoom(){
if(map == null){
return 1;
} else {
return map.getMinimumZoomSupported();
}
}
public void setZoom(float zoom) {
if ((map == null && zoom < 22 && zoom > 0)
|| (map != null && (map.getMaximumZoomSupported() + OVERZOOM_IN) >= zoom && map.getMinimumZoomSupported() <= zoom)) {
if (zoom <= getMaximumShownMapZoom() && zoom >= getMinimumShownMapZoom()) {
animatedDraggingThread.stopAnimating();
this.zoom = zoom;
refreshMap();