aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-13 19:12:41 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-13 19:12:41 -0600
commit1d85d8b5909b168186cfc800c0105356a521eed4 (patch)
tree4cef00aa6d5a5071a1010c3ecc2585642dcc4459
parent40b9a03ecb0d0f191934fb2e6102c6e7e05aef5e (diff)
downloadetbsa-trackermap-mobile-1d85d8b5909b168186cfc800c0105356a521eed4.tar.gz
etbsa-trackermap-mobile-1d85d8b5909b168186cfc800c0105356a521eed4.tar.bz2
etbsa-trackermap-mobile-1d85d8b5909b168186cfc800c0105356a521eed4.zip
Disable map filter auto centering when unit is selected
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt4
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt3
2 files changed, 4 insertions, 3 deletions
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<Marker>, isReport: Boolean) {
+ fun display(markers: Array<Marker>, 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
)
}