"Map center" jumps to previous point location after route calculation
This commit is contained in:
parent
ba19772b58
commit
0919e44ce2
4 changed files with 14 additions and 8 deletions
|
@ -473,6 +473,10 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshChart(LineChart chart, boolean forceFit) {
|
public void refreshChart(LineChart chart, boolean forceFit) {
|
||||||
|
refreshChart(chart, true, forceFit);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void refreshChart(LineChart chart, boolean fitTrackOnMap, boolean forceFit) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
GpxDisplayItem gpxItem = getGpxItem();
|
GpxDisplayItem gpxItem = getGpxItem();
|
||||||
if (mapActivity == null || gpxItem == null) {
|
if (mapActivity == null || gpxItem == null) {
|
||||||
|
@ -529,8 +533,10 @@ public class TrackDetailsMenu {
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
if (fitTrackOnMap) {
|
||||||
fitTrackOnMap(chart, location, forceFit);
|
fitTrackOnMap(chart, location, forceFit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean shouldShowXAxisPoints () {
|
public boolean shouldShowXAxisPoints () {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -311,7 +311,7 @@ public class GraphsCard extends BaseCard implements OnUpdateInfoListener {
|
||||||
private void updateChartOnMap() {
|
private void updateChartOnMap() {
|
||||||
if (hasVisibleGraph()) {
|
if (hasVisibleGraph()) {
|
||||||
trackDetailsMenu.reset();
|
trackDetailsMenu.reset();
|
||||||
refreshMapCallback.refreshMap(false);
|
refreshMapCallback.refreshMap(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,11 +105,11 @@ public class GraphAdapterHelper {
|
||||||
@NonNull final TrackDetailsMenu detailsMenu) {
|
@NonNull final TrackDetailsMenu detailsMenu) {
|
||||||
final RefreshMapCallback refreshMapCallback = new RefreshMapCallback() {
|
final RefreshMapCallback refreshMapCallback = new RefreshMapCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void refreshMap(boolean forceFit) {
|
public void refreshMap(boolean fitTrackOnMap, boolean forceFit) {
|
||||||
LineChart chart = graphAdapter.getChart();
|
LineChart chart = graphAdapter.getChart();
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
if (!app.getRoutingHelper().isFollowingMode()) {
|
if (!app.getRoutingHelper().isFollowingMode()) {
|
||||||
detailsMenu.refreshChart(chart, forceFit);
|
detailsMenu.refreshChart(chart, fitTrackOnMap, forceFit);
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public class GraphAdapterHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onValueSelected(Entry e, Highlight h) {
|
public void onValueSelected(Entry e, Highlight h) {
|
||||||
refreshMapCallback.refreshMap(false);
|
refreshMapCallback.refreshMap(true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -141,7 +141,7 @@ public class GraphAdapterHelper {
|
||||||
lastPerformedGesture == ChartTouchListener.ChartGesture.PINCH_ZOOM ||
|
lastPerformedGesture == ChartTouchListener.ChartGesture.PINCH_ZOOM ||
|
||||||
lastPerformedGesture == ChartTouchListener.ChartGesture.DOUBLE_TAP ||
|
lastPerformedGesture == ChartTouchListener.ChartGesture.DOUBLE_TAP ||
|
||||||
lastPerformedGesture == ChartTouchListener.ChartGesture.ROTATE) {
|
lastPerformedGesture == ChartTouchListener.ChartGesture.ROTATE) {
|
||||||
refreshMapCallback.refreshMap(true);
|
refreshMapCallback.refreshMap(true, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -150,6 +150,6 @@ public class GraphAdapterHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface RefreshMapCallback {
|
public interface RefreshMapCallback {
|
||||||
void refreshMap(boolean forceFit);
|
void refreshMap(boolean fitTrackOnMap, boolean forceFit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,7 +369,7 @@ public class RouteDetailsFragment extends ContextMenuFragment
|
||||||
super.calculateLayout(view, initLayout);
|
super.calculateLayout(view, initLayout);
|
||||||
if (!initLayout && getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
if (!initLayout && getCurrentMenuState() != MenuState.FULL_SCREEN) {
|
||||||
if (refreshMapCallback != null) {
|
if (refreshMapCallback != null) {
|
||||||
refreshMapCallback.refreshMap(false);
|
refreshMapCallback.refreshMap(false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue