From f449ae598bffa97435eb5796546b3fac9279bfe5 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 28 Jul 2020 14:52:36 +0300 Subject: [PATCH 1/2] Current location move graph to one-fourth of the visible range --- .../plus/mapcontextmenu/other/TrackDetailsMenu.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index 4de36e90c3..98a022061d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -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 > 0) { + nextVisibleX = pos - oneFourthDiff; + } gpxItem.chartHighlightPos = pos; chart.moveViewToX(nextVisibleX); From 74125e9925c75c7b288a2e3f2bb9a88b54fdadad Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 28 Jul 2020 15:17:55 +0300 Subject: [PATCH 2/2] Remove unnecessary subtraction --- .../net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index 98a022061d..dd8e64825c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -152,7 +152,7 @@ public class TrackDetailsMenu { float highestVisibleX = chart.getHighestVisibleX(); float nextVisibleX = lowestVisibleX + (pos - gpxItem.chartHighlightPos); float oneFourthDiff = (highestVisibleX - lowestVisibleX) / 4f; - if (pos - oneFourthDiff > 0) { + if (pos > oneFourthDiff) { nextVisibleX = pos - oneFourthDiff; } gpxItem.chartHighlightPos = pos;