mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-22 22:23:44 +00:00
[ios] Skip elevation info current point updates when the data is nil
Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
committed by
Yannik Bloscheck
parent
d94351a8f1
commit
266d62831f
@@ -72,12 +72,12 @@ extension ElevationProfilePresenter: ElevationProfilePresenterProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateActivePointDistance(_ distance: Double) {
|
func updateActivePointDistance(_ distance: Double) {
|
||||||
guard let view, !view.isChartViewInfoHidden else { return }
|
guard let view, view.canReceiveUpdates else { return }
|
||||||
view.setActivePointDistance(distance)
|
view.setActivePointDistance(distance)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateMyPositionDistance(_ distance: Double) {
|
func updateMyPositionDistance(_ distance: Double) {
|
||||||
guard let view, !view.isChartViewInfoHidden else { return }
|
guard let view, view.canReceiveUpdates else { return }
|
||||||
view.setMyPositionDistance(distance)
|
view.setMyPositionDistance(distance)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ protocol ElevationProfileViewProtocol: AnyObject {
|
|||||||
var userInteractionEnabled: Bool { get set }
|
var userInteractionEnabled: Bool { get set }
|
||||||
var isChartViewHidden: Bool { get set }
|
var isChartViewHidden: Bool { get set }
|
||||||
var isChartViewInfoHidden: Bool { get set }
|
var isChartViewInfoHidden: Bool { get set }
|
||||||
|
var canReceiveUpdates: Bool { get }
|
||||||
|
|
||||||
func setChartData(_ data: ChartPresentationData)
|
func setChartData(_ data: ChartPresentationData)
|
||||||
func setActivePointDistance(_ distance: Double)
|
func setActivePointDistance(_ distance: Double)
|
||||||
@@ -139,6 +140,10 @@ extension ElevationProfileViewController: ElevationProfileViewProtocol {
|
|||||||
set { chartView.isChartViewInfoHidden = newValue }
|
set { chartView.isChartViewInfoHidden = newValue }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var canReceiveUpdates: Bool {
|
||||||
|
chartView.chartData != nil
|
||||||
|
}
|
||||||
|
|
||||||
func setChartData(_ data: ChartPresentationData) {
|
func setChartData(_ data: ChartPresentationData) {
|
||||||
chartView.chartData = data
|
chartView.chartData = data
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user