Merge pull request #9531 from osmandapp/analyze_screen_fixes

Analyze screen follow current point fixes
This commit is contained in:
vshcherb 2020-07-28 16:40:15 +02:00 committed by GitHub
commit 74346609a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -148,7 +148,13 @@ public class TrackDetailsMenu {
LatLon latLon = tb.getLatLonFromPixel(mx, my);
gpxItem.locationOnMap = GPXLayer.createProjectionPoint(points.first, points.second, latLon);
float pos = (float) (gpxItem.locationOnMap.distance / ((OrderedLineDataSet) ds.get(0)).getDivX());
float nextVisibleX = chart.getLowestVisibleX() + (pos - gpxItem.chartHighlightPos);
float lowestVisibleX = chart.getLowestVisibleX();
float highestVisibleX = chart.getHighestVisibleX();
float nextVisibleX = lowestVisibleX + (pos - gpxItem.chartHighlightPos);
float oneFourthDiff = (highestVisibleX - lowestVisibleX) / 4f;
if (pos > oneFourthDiff) {
nextVisibleX = pos - oneFourthDiff;
}
gpxItem.chartHighlightPos = pos;
chart.moveViewToX(nextVisibleX);