fix ui autozoom hysterisis
git-svn-id: https://osmand.googlecode.com/svn/trunk@750 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
30537850f5
commit
529b25a33d
1 changed files with 7 additions and 1 deletions
|
@ -123,6 +123,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
@SuppressWarnings("unused")
|
||||
private boolean providerSupportsSpeed = false;
|
||||
private String currentLocationProvider = null;
|
||||
private long lastTimeAutoZooming = 0;
|
||||
|
||||
/** Called when the activity is first created. */
|
||||
private OsmandMapTileView mapView;
|
||||
|
@ -511,7 +512,12 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
if(OsmandSettings.isAutoZoomEnabled(settings) && location.hasSpeed()){
|
||||
int z = defineZoomFromSpeed(location.getSpeed(), mapView.getZoom());
|
||||
if(mapView.getZoom() != z && !mapView.mapIsAnimating()){
|
||||
mapView.setZoom(z);
|
||||
long now = System.currentTimeMillis();
|
||||
// prevent ui hysterisis (check time interval for autozoom)
|
||||
if(Math.abs(mapView.getZoom() - z) > 2 || (lastTimeAutoZooming - now) > 6500){
|
||||
lastTimeAutoZooming = now;
|
||||
mapView.setZoom(z);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (location.hasBearing() && currentMapRotation == OsmandSettings.ROTATE_MAP_BEARING && !mapView.mapIsAnimating()) {
|
||||
|
|
Loading…
Reference in a new issue