Skip to content

Commit 5cca21c

Browse files
committed
Display the selected index and move the status toolbar to the left
1 parent 9d7d7cd commit 5cca21c

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

examples/Example03Markers/src/main/kotlin/de/afarber/openmapview/example03markers/MainActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ fun MapViewScreen() {
158158

159159
// Status overlay at top
160160
StatusToolbar(
161-
markerCount = mapView?.getMarkers()?.size ?: 0,
161+
selectedIndex = selectedIndex,
162162
selectedMarkerTitle = selectedMarker?.title,
163163
cameraState = cameraState,
164164
modifier = Modifier
165-
.align(Alignment.TopCenter)
165+
.align(Alignment.CenterStart)
166166
.padding(16.dp),
167167
)
168168

examples/Example03Markers/src/main/kotlin/de/afarber/openmapview/example03markers/StatusToolbar.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,16 @@ import androidx.compose.ui.unit.dp
2222
/**
2323
* A status overlay displaying current marker and camera state information.
2424
*
25-
* Shows the total marker count, currently selected marker name, and camera state.
25+
* Shows the currently selected marker index and name, and camera state.
2626
*
27-
* @param markerCount Total number of markers currently on the map.
27+
* @param selectedIndex The index of the currently selected marker.
2828
* @param selectedMarkerTitle Title of the currently selected marker, or null if none selected.
2929
* @param cameraState Current camera state description (e.g., "Idle", "Moving (gesture)").
3030
* @param modifier Modifier to be applied to the status overlay.
3131
*/
3232
@Composable
3333
fun StatusToolbar(
34-
markerCount: Int,
34+
selectedIndex: Int,
3535
selectedMarkerTitle: String?,
3636
cameraState: String,
3737
modifier: Modifier = Modifier,
@@ -44,7 +44,7 @@ fun StatusToolbar(
4444
horizontalAlignment = Alignment.CenterHorizontally,
4545
) {
4646
Text(
47-
text = "Markers: $markerCount",
47+
text = "Marker #${selectedIndex + 1}",
4848
color = Color.Black,
4949
)
5050
Text(

0 commit comments

Comments
 (0)