diff --git a/iphone/Chart/Chart/Views/ChartInfo/ChartPointInfoView.swift b/iphone/Chart/Chart/Views/ChartInfo/ChartPointInfoView.swift index 87a2f4dc8..feda061a1 100644 --- a/iphone/Chart/Chart/Views/ChartInfo/ChartPointInfoView.swift +++ b/iphone/Chart/Chart/Views/ChartInfo/ChartPointInfoView.swift @@ -94,7 +94,7 @@ final class ChartPointInfoView: UIView { func update(x: CGFloat, label: String, points: [ChartLineInfo]) { distanceLabel.text = label altitudeLabel.text = altitudeText(points[0]) - layoutIfNeeded() + setNeedsLayout() } private func altitudeText(_ point: ChartLineInfo) -> String { diff --git a/iphone/Chart/Chart/Views/ChartView.swift b/iphone/Chart/Chart/Views/ChartView.swift index 682b62124..90678cde7 100644 --- a/iphone/Chart/Chart/Views/ChartView.swift +++ b/iphone/Chart/Chart/Views/ChartView.swift @@ -16,6 +16,7 @@ public class ChartView: UIView { var showPreview: Bool = false // Set true to show the preview private var tapGR: UITapGestureRecognizer! + private var selectedPointDistance: Double = 0 private var panStartPoint = 0 private var panGR: UIPanGestureRecognizer! private var pinchStartLower = 0 @@ -170,6 +171,8 @@ public class ChartView: UIView { } public func setSelectedPoint(_ x: Double) { + guard selectedPointDistance != x else { return } + selectedPointDistance = x let routeLength = chartData.xAxisValueAt(CGFloat(chartData.pointsCount - 1)) let upper = chartData.xAxisValueAt(CGFloat(chartPreviewView.maxX)) var lower = chartData.xAxisValueAt(CGFloat(chartPreviewView.minX))