diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-02-04 02:20:29 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-02-04 02:20:29 -0600 |
commit | dac657032851dbd6b13be72253e4f8777c67b439 (patch) | |
tree | e1c8abbb7a7bde807d2d0b8d5b7ec06facc7d975 /iosApp/iosApp/Units/UnitsViewModel.swift | |
parent | 48e9f6e38213c533286d83e426346471d507467d (diff) | |
download | etbsa-trackermap-mobile-dac657032851dbd6b13be72253e4f8777c67b439.tar.gz etbsa-trackermap-mobile-dac657032851dbd6b13be72253e4f8777c67b439.tar.bz2 etbsa-trackermap-mobile-dac657032851dbd6b13be72253e4f8777c67b439.zip |
- Center selected marker in map has been implemented.
- Initial zoom on map works again.
Diffstat (limited to 'iosApp/iosApp/Units/UnitsViewModel.swift')
-rw-r--r-- | iosApp/iosApp/Units/UnitsViewModel.swift | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/iosApp/iosApp/Units/UnitsViewModel.swift b/iosApp/iosApp/Units/UnitsViewModel.swift index dc6236f..8cf4aae 100644 --- a/iosApp/iosApp/Units/UnitsViewModel.swift +++ b/iosApp/iosApp/Units/UnitsViewModel.swift @@ -55,7 +55,16 @@ class UnitsViewModel: ObservableObject { } } @Published var markers: [Marker] = [] - @Published var selectedUnit: UnitInformation? = nil + @Published var selectedUnit: UnitInformation? = nil { + didSet { + if let unit = selectedUnit { + selectedMarker = Marker.companion.fromUnit(unit: unit) + } else { + selectedMarker = nil + } + } + } + @Published var selectedMarker: Marker? = nil @Published var mapLayerType: MapLayer = .companion.defaultLayer @Published var geofences: [Int: Geofence] = [:] @Published var camera: Camera = Camera() |