diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-18 00:29:31 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-18 00:29:31 -0600 |
commit | 7dd62c690e4b9db4a98c43591caa297b97c89b37 (patch) | |
tree | 25df1e3df313922a2c60ebc76d206250cacf2e67 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/map | |
parent | 5b39665ccdf318fe3b43fa76519484bc98764884 (diff) | |
download | etbsa-trackermap-mobile-7dd62c690e4b9db4a98c43591caa297b97c89b37.tar.gz etbsa-trackermap-mobile-7dd62c690e4b9db4a98c43591caa297b97c89b37.tar.bz2 etbsa-trackermap-mobile-7dd62c690e4b9db4a98c43591caa297b97c89b37.zip |
More improvements to zoom
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/map')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt index ca59266..e64afd3 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt @@ -93,6 +93,10 @@ class UnitMapFragment : Fragment() { binding.mapUnitCard.visibility = if (selectedUnit == null) View.GONE else View.VISIBLE + if (selectedUnit == null) { + unitsViewModel.clearCamera() + } + selectedUnit?.let { unit -> if (unit.position == null || unit.position?.latitude == null || unit.position?.longitude == null) { binding.mapUnitCard.visibility = View.GONE @@ -142,7 +146,9 @@ class UnitMapFragment : Fragment() { } unitsViewModel.camera.observe(viewLifecycleOwner) { camera -> - mapFragment.focusOn(camera.point.y, camera.point.x) + camera?.let { + mapFragment.focusOn(camera.point.y, camera.point.x) + } } } |