mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
parent
6b3ae27c67
commit
27aacd1fbc
1 changed files with 6 additions and 5 deletions
|
|
@ -90,10 +90,12 @@ internal fun rememberMapViewWithLifecycle(
|
||||||
tileSource: ITileSource = TileSourceFactory.DEFAULT_TILE_SOURCE,
|
tileSource: ITileSource = TileSourceFactory.DEFAULT_TILE_SOURCE,
|
||||||
): MapView {
|
): MapView {
|
||||||
var savedZoom by rememberSaveable { mutableDoubleStateOf(zoomLevel) }
|
var savedZoom by rememberSaveable { mutableDoubleStateOf(zoomLevel) }
|
||||||
var savedCenter by rememberSaveable(stateSaver = Saver(
|
var savedCenter by rememberSaveable(
|
||||||
save = { mapOf("latitude" to it.latitude, "longitude" to it.longitude) },
|
stateSaver = Saver(
|
||||||
restore = { GeoPoint(it["latitude"] ?: 0.0, it["longitude"] ?: .0) }
|
save = { mapOf("latitude" to it.latitude, "longitude" to it.longitude) },
|
||||||
)) { mutableStateOf(mapCenter) }
|
restore = { GeoPoint(it["latitude"] ?: 0.0, it["longitude"] ?: .0) }
|
||||||
|
)
|
||||||
|
) { mutableStateOf(mapCenter) }
|
||||||
|
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val mapView = remember {
|
val mapView = remember {
|
||||||
|
|
@ -155,7 +157,6 @@ internal fun rememberMapViewWithLifecycle(
|
||||||
onDispose {
|
onDispose {
|
||||||
lifecycle.removeObserver(observer)
|
lifecycle.removeObserver(observer)
|
||||||
wakeLock.safeRelease()
|
wakeLock.safeRelease()
|
||||||
mapView.onDetach()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return mapView
|
return mapView
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue