From 7789f475200134a6f1c0c7a855b52ccc2abe2555 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Thu, 13 Jan 2022 19:12:41 -0600 Subject: Disable map filter auto centering when unit is selected --- .../src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt | 4 ++-- .../main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'androidApp/src') diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt index e3f4ead..a45b864 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt @@ -127,7 +127,7 @@ class MapFragment : GlobeMapFragment() { } } - fun display(markers: Array, isReport: Boolean) { + fun display(markers: Array, isReport: Boolean, center: Boolean = true) { Log.d("MapFragment", "Displaying markers") clear() @@ -219,7 +219,7 @@ class MapFragment : GlobeMapFragment() { } // Center map to bounds - if (markers.isNotEmpty()) { + if (center && markers.isNotEmpty()) { val mbr = Mbr() points.forEach { mbr.addPoint(it) 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 cc9a551..f79f8bd 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 @@ -63,7 +63,8 @@ class UnitMapFragment(private val unitsViewModel: UnitsViewModel) : UnitFragment unitsMapFragment.display( units.mapNotNull(MarkerTransformations::unitToMarker).toTypedArray(), - isReport = false + isReport = false, + center = unitsViewModel.selectedUnit.value == null ) } -- cgit v1.2.3