From 569dc21c4ce8cca700503ef4080076b5cfa2add5 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Wed, 1 Jul 2020 23:36:01 +0300 Subject: [PATCH 1/2] Move chart with my location and try to keep marker position and scale constant --- .../osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java | 6 +++++- 1 file changed, 5 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 1f3a8443d6..59189cceaf 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -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; From 4cb68abd436bf6ca77563310ddcaac65afb0bbcc Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Thu, 2 Jul 2020 10:12:15 +0300 Subject: [PATCH 2/2] Remove zoom out animation when dragging point on the chart --- .../plus/mapcontextmenu/other/TrackDetailsMenu.java | 8 ++++---- 1 file changed, 4 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 59189cceaf..fdc58e7831 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/TrackDetailsMenu.java @@ -145,9 +145,9 @@ 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)); - float nextHighlightPos = (float) (gpxItem.locationOnMap.distance / ((OrderedLineDataSet) ds.get(0)).getDivX()); - float nextVisibleX = chart.getLowestVisibleX() + (nextHighlightPos - gpxItem.chartHighlightPos); - gpxItem.chartHighlightPos = nextHighlightPos; + float pos = (float) (gpxItem.locationOnMap.distance / ((OrderedLineDataSet) ds.get(0)).getDivX()); + float nextVisibleX = chart.getLowestVisibleX() + (pos - gpxItem.chartHighlightPos); + gpxItem.chartHighlightPos = pos; chart.moveViewToX(nextVisibleX); chart.highlightValue(gpxItem.chartHighlightPos, 0); @@ -613,7 +613,7 @@ public class TrackDetailsMenu { lastPerformedGesture == ChartGesture.ROTATE) { gpxItem.chartMatrix = new Matrix(chart.getViewPortHandler().getMatrixTouch()); - refreshChart(chart, true); + refreshChart(chart, false); } } }