Fix autozoom erros and rotate

This commit is contained in:
vshcherb 2013-10-09 17:44:36 +02:00
parent 0104124875
commit 41caeaaaa3
2 changed files with 9 additions and 4 deletions

View file

@ -615,7 +615,10 @@ public class OsmandSettings {
public final OsmandPreference<Boolean> USE_MAGNETIC_FIELD_SENSOR_COMPASS = new BooleanPreference("use_magnetic_field_sensor_compass", true).makeGlobal().cache();
public final OsmandPreference<Boolean> USE_KALMAN_FILTER_FOR_COMPASS = new BooleanPreference("use_kalman_filter_compass", true).makeGlobal().cache();
public final OsmandPreference<Float> MAP_ZOOM_SCALE_BY_DENSITY = new FloatPreference("map_zoom_scale_wo_density", 0f).makeProfile().cache();
public final CommonPreference<Float> MAP_ZOOM_SCALE_BY_DENSITY = new FloatPreference("map_zoom_scale_wo_density", 0f).makeProfile().cache();
{
MAP_ZOOM_SCALE_BY_DENSITY.setModeDefaultValue(ApplicationMode.CAR, 0.5f);
}
// this value string is synchronized with settings_pref.xml preference name

View file

@ -183,11 +183,13 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
}
if (now - lastTimeAutoZooming > 4500) {
lastTimeAutoZooming = now;
float settingsZoomScale = mapView.getSettingsZoomScale();
float complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
// round to 0.5
float newZoom = Math.round(complexZoom * 2) * 0.5f;
final int tz = (int)newZoom;
mapView.setComplexZoom(tz, newZoom - tz);
float newZoom = Math.round((complexZoom - settingsZoomScale) * 2) * 0.5f;
int nz = (int)newZoom;
float nzscale = newZoom - nz + settingsZoomScale;
mapView.setComplexZoom(nz, nzscale);
// mapView.getAnimatedDraggingThread().startZooming(mapView.getFloatZoom() + zdelta, false);
}
}