From 273baf1982beac68a1e32fb238b490b9cd43e9dc Mon Sep 17 00:00:00 2001 From: Isidro Henoch Date: Sun, 16 Jan 2022 21:34:22 -0600 Subject: Fixes the zoom levels issue when changing map tiles --- .../main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'androidApp') 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 90ee36a..e96945e 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 @@ -101,6 +101,10 @@ class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment unitsViewModel.mapLayer.observe(viewLifecycleOwner) { layer -> Log.d("UnitMapFragment", "Loading layer!") unitsMapFragment.updateTile(layer) + val selectedUnit = unitsViewModel.selectedUnit.value + selectedUnit?.let { + unitsMapFragment.focusOn(it.position!!.latitude!!, it.position!!.longitude!!) + } binding.attributionText.text = HtmlCompat.fromHtml(layer.attribution, 0) } -- cgit v1.2.3