Merge pull request #947 from Bars107/zoom
Fixed issue when user tried to zoom out map during navigation and map in...
This commit is contained in:
commit
ec9325ede4
3 changed files with 21 additions and 5 deletions
|
@ -456,6 +456,11 @@ public class MapActivity extends AccessibleActivity implements
|
|||
}
|
||||
}
|
||||
|
||||
public void changeZoom(int stp, long time) {
|
||||
mapViewTrackingUtilities.setZoomTime(time);
|
||||
changeZoom(stp);
|
||||
}
|
||||
|
||||
public void changeZoom(int stp){
|
||||
// delta = Math.round(delta * OsmandMapTileView.ZOOM_DELTA) * OsmandMapTileView.ZOOM_DELTA_1;
|
||||
boolean changeLocation = false;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package net.osmand.plus.base;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.Location;
|
||||
|
@ -36,6 +38,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
private boolean followingMode;
|
||||
private boolean routePlanningMode;
|
||||
private boolean showViewAngle = false;
|
||||
private boolean isUserZoomed = false;
|
||||
|
||||
public MapViewTrackingUtilities(OsmandApplication app){
|
||||
this.app = app;
|
||||
|
@ -196,7 +199,9 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
// decrease a bit
|
||||
zdelta += 1;
|
||||
}
|
||||
if (now - lastTimeAutoZooming > 4500) {
|
||||
int threshold = settings.AUTO_FOLLOW_ROUTE.get();
|
||||
if (now - lastTimeAutoZooming > 4500 && (now - lastTimeAutoZooming > threshold || !isUserZoomed)) {
|
||||
isUserZoomed = false;
|
||||
lastTimeAutoZooming = now;
|
||||
double settingsZoomScale = mapView.getSettingsZoomScale();
|
||||
double complexZoom = tb.getZoom() + tb.getZoomScale() + zdelta;
|
||||
|
@ -320,5 +325,9 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc
|
|||
public void routeWasCancelled() {
|
||||
}
|
||||
|
||||
public void setZoomTime(long time) {
|
||||
lastTimeAutoZooming = time;
|
||||
isUserZoomed = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.view.Gravity;
|
|||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
|
@ -83,9 +84,9 @@ public class MapZoomControls extends MapControls {
|
|||
public void onClick(View v) {
|
||||
notifyClicked();
|
||||
if (view.isZooming()) {
|
||||
mapActivity.changeZoom(2);
|
||||
mapActivity.changeZoom(2, System.currentTimeMillis());
|
||||
} else {
|
||||
mapActivity.changeZoom(1);
|
||||
mapActivity.changeZoom(1, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -95,8 +96,9 @@ public class MapZoomControls extends MapControls {
|
|||
zoomOutButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
long time = Calendar.getInstance().getTime().getTime();
|
||||
notifyClicked();
|
||||
mapActivity.changeZoom(-1);
|
||||
mapActivity.changeZoom(-1, System.currentTimeMillis());
|
||||
}
|
||||
});
|
||||
zoomOutButton.setOnLongClickListener(listener);
|
||||
|
|
Loading…
Reference in a new issue