mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: enhance map navigation and waypoint handling (#4814)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
802aa09aab
commit
5edb8abd05
15 changed files with 95 additions and 16 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package org.meshtastic.app.map
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.ui.Modifier
|
||||
import org.koin.compose.viewmodel.koinViewModel
|
||||
import org.koin.core.annotation.Single
|
||||
|
|
@ -34,8 +35,10 @@ class FdroidMapViewProvider : MapViewProvider {
|
|||
tracerouteOverlay: Any?,
|
||||
tracerouteNodePositions: Map<Int, Any>,
|
||||
onTracerouteMappableCountChanged: (Int, Int) -> Unit,
|
||||
waypointId: Int?,
|
||||
) {
|
||||
val mapViewModel: MapViewModel = koinViewModel()
|
||||
LaunchedEffect(waypointId) { mapViewModel.setWaypointId(waypointId) }
|
||||
org.meshtastic.app.map.MapView(
|
||||
modifier = modifier,
|
||||
mapViewModel = mapViewModel,
|
||||
|
|
|
|||
|
|
@ -47,6 +47,12 @@ class MapViewModel(
|
|||
private val _selectedWaypointId = MutableStateFlow(savedStateHandle.get<Int>("waypointId"))
|
||||
val selectedWaypointId: StateFlow<Int?> = _selectedWaypointId.asStateFlow()
|
||||
|
||||
fun setWaypointId(id: Int?) {
|
||||
if (id != null) {
|
||||
_selectedWaypointId.value = id
|
||||
}
|
||||
}
|
||||
|
||||
var mapStyleId: Int
|
||||
get() = mapPrefs.mapStyle.value
|
||||
set(value) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue