Move chart with my location and try to keep marker position and scale constant

This commit is contained in:
Vitaliy 2020-07-01 23:36:01 +03:00
parent becf299a05
commit 569dc21c4c

View file

@ -145,7 +145,11 @@ public class TrackDetailsMenu {
if (point != null) {
int index = segment.points.indexOf(point);
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);
}
myLocation = location;