Cancel snap to road after selecting default app mode
This commit is contained in:
parent
bb34542043
commit
833aebd171
1 changed files with 6 additions and 1 deletions
|
@ -408,9 +408,13 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationModeItemClick(ApplicationMode mode) {
|
public void onApplicationModeItemClick(ApplicationMode mode) {
|
||||||
if (planRouteContext.getSnappedMode() != mode) {
|
if (planRouteContext.getSnappedMode() != mode) {
|
||||||
|
boolean defaultMode = mode == ApplicationMode.DEFAULT;
|
||||||
MapMarkersLayer layer = getMapMarkersLayer();
|
MapMarkersLayer layer = getMapMarkersLayer();
|
||||||
if (layer != null) {
|
if (layer != null) {
|
||||||
layer.setDefaultAppMode(mode == ApplicationMode.DEFAULT);
|
layer.setDefaultAppMode(defaultMode);
|
||||||
|
}
|
||||||
|
if (defaultMode) {
|
||||||
|
planRouteContext.cancelSnapToRoad();
|
||||||
}
|
}
|
||||||
planRouteContext.getSnappedToRoadPoints().clear();
|
planRouteContext.getSnappedToRoadPoints().clear();
|
||||||
planRouteContext.setSnappedMode(mode);
|
planRouteContext.setSnappedMode(mode);
|
||||||
|
@ -731,6 +735,7 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
mapActivity.getMapLayers().getMapMarkersLayer().setRoute(planRouteContext.getSnapTrkSegment());
|
mapActivity.getMapLayers().getMapMarkersLayer().setRoute(planRouteContext.getSnapTrkSegment());
|
||||||
|
mapActivity.refreshMap();
|
||||||
if (adjustMap) {
|
if (adjustMap) {
|
||||||
showRouteOnMap(planRouteContext.getSnapTrkSegment().points);
|
showRouteOnMap(planRouteContext.getSnapTrkSegment().points);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue