Move chart with my location and try to keep marker position and scale constant
This commit is contained in:
parent
becf299a05
commit
569dc21c4c
1 changed files with 5 additions and 1 deletions
|
@ -145,7 +145,11 @@ public class TrackDetailsMenu {
|
||||||
if (point != null) {
|
if (point != null) {
|
||||||
int index = segment.points.indexOf(point);
|
int index = segment.points.indexOf(point);
|
||||||
gpxItem.locationOnMap = GPXLayer.createProjectionPoint(segment.points.get(index - 1), point, tb.getLatLonFromPixel(mx, my));
|
gpxItem.locationOnMap = GPXLayer.createProjectionPoint(segment.points.get(index - 1), point, tb.getLatLonFromPixel(mx, my));
|
||||||
gpxItem.chartHighlightPos = (float) (gpxItem.locationOnMap.distance / ((OrderedLineDataSet) ds.get(0)).getDivX());
|
float nextHighlightPos = (float) (gpxItem.locationOnMap.distance / ((OrderedLineDataSet) ds.get(0)).getDivX());
|
||||||
|
float nextVisibleX = chart.getLowestVisibleX() + (nextHighlightPos - gpxItem.chartHighlightPos);
|
||||||
|
gpxItem.chartHighlightPos = nextHighlightPos;
|
||||||
|
|
||||||
|
chart.moveViewToX(nextVisibleX);
|
||||||
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||||
}
|
}
|
||||||
myLocation = location;
|
myLocation = location;
|
||||||
|
|
Loading…
Reference in a new issue