mirror of
https://github.com/atsunatsu/Look4Sat.git
synced 2026-10-02 03:15:37 +00:00
feat: mutual match screen target-grid chip (needle bearing + grid + distance); grid mode centering no longer swallowed when station position is not yet available
This commit is contained in:
1 parent
2c9a5b376f
commit
a9fe0b74e9
4 files changed
+181
-5
No files matched your search
@@ -165,11 +165,18 @@ private fun MapScreen(uiState: MapState, onAction: (MapAction) -> Unit, mapView:
|
||||
// the map page with grid mode already ON also centers the map.
|
||||
var prevGridMode by remember { mutableStateOf(false) }
|
||||
AndroidView({ mapView }) { view ->
|
||||
// Center on the station grid whenever entering grid mode.
|
||||
// Only mark the transition as consumed once a real position
|
||||
// was available; otherwise a first frame with a null
|
||||
// stationPosition would swallow the centering forever.
|
||||
val shouldCenter = uiState.isGridMode && !prevGridMode
|
||||
setGridMode(
|
||||
uiState.isGridMode, uiState.workedGrids, view,
|
||||
if (uiState.isGridMode && !prevGridMode) uiState.stationPosition else null
|
||||
if (shouldCenter) uiState.stationPosition else null
|
||||
)
|
||||
prevGridMode = uiState.isGridMode
|
||||
if (!shouldCenter || uiState.stationPosition != null) {
|
||||
prevGridMode = uiState.isGridMode
|
||||
}
|
||||
if (!uiState.isGridMode) {
|
||||
uiState.stationPosition?.let { setStationPosition(it, view) }
|
||||
uiState.track?.let { setSatelliteTrack(it, view) }
|
||||
|
||||
Reference in new issue
Block a user