From ff07951c8825f00b5073eebbc18684063d7c4975 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Mon, 19 Jun 2017 17:55:37 +0300 Subject: [PATCH] Fix highlighting --- .../mapcontextmenu/other/TrackDetailsMenu.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java index a487e35cef..86affae6d0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -293,10 +293,18 @@ public class TrackDetailsMenu { float maximumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentRight(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x; if (highlights != null && highlights.length > 0) { - if (highlights[0].getX() < minimumVisibleXValue) { - gpxItem.chartHighlightPos = minimumVisibleXValue; - } else if (highlights[0].getX() > maximumVisibleXValue) { - gpxItem.chartHighlightPos = maximumVisibleXValue; + if (minimumVisibleXValue != 0 && maximumVisibleXValue != 0) { + if (highlights[0].getX() < minimumVisibleXValue) { + Highlight h = chart.getHighlightByTouchPoint(minimumVisibleXValue, 0f); + chart.highlightValue(h); + gpxItem.chartHighlightPos = minimumVisibleXValue; + } else if (highlights[0].getX() > maximumVisibleXValue) { + Highlight h = chart.getHighlightByTouchPoint(maximumVisibleXValue, 0f); + chart.highlightValue(h); + gpxItem.chartHighlightPos = maximumVisibleXValue; + } else { + gpxItem.chartHighlightPos = highlights[0].getX(); + } } else { gpxItem.chartHighlightPos = highlights[0].getX(); }