Fix moving target

This commit is contained in:
Victor Shcherb 2015-03-24 02:07:44 +01:00
parent 5ebfa2decf
commit 95b2a20e2c

View file

@ -328,7 +328,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
LatLon lt = new LatLon(l.getLatitude(), l.getLongitude()); LatLon lt = new LatLon(l.getLatitude(), l.getLongitude());
boolean cancelDestinationId = false; boolean cancelDestinationId = false;
if(followTargetLocation != null ) { if(followTargetLocation != null ) {
if(pn == null || pn.point == null || !pn.point.equals(followTargetLocation) ) { if(pn == null || pn.point == null || MapUtils.getDistance(pn.point, followTargetLocation) > 10) {
cancelDestinationId = true; cancelDestinationId = true;
} }
} }
@ -360,7 +360,7 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
sameObject = false; sameObject = false;
} }
LatLon mapLoc = new LatLon(map.getMapView().getLatitude(), map.getMapView().getLongitude()); LatLon mapLoc = new LatLon(map.getMapView().getLatitude(), map.getMapView().getLongitude());
final boolean centered = Algorithms.objectEquals(followMapLocation, mapLoc); final boolean centered = followMapLocation != null && MapUtils.getDistance(mapLoc, followMapLocation) < 1;
if(sameObject || centered) { if(sameObject || centered) {
final LatLon loc; final LatLon loc;
if(centered ) { if(centered ) {