@@ -75,6 +75,7 @@ import kotlinx.coroutines.launch
75
75
* @param wrapAroundMode the [WrapAroundMode] to specify whether continuous panning across the international date line is enabled
76
76
* @param attributionState specifies the attribution bar's visibility, text changed and layout changed events
77
77
* @param onViewpointChanged lambda invoked when the viewpoint of the composable MapView has changed
78
+ * @param onNavigationChanged lambda invoked when the navigation status of the composable MapView has changed
78
79
* @param onMapRotationChanged lambda invoked when the rotation of this composable MapView has changed
79
80
* @param onMapScaleChanged lambda invoked when the scale of this composable MapView has changed
80
81
* @param onSpatialReferenceChanged lambda invoked when the spatial reference of the composable MapView has changed
@@ -108,6 +109,7 @@ public fun MapView(
108
109
wrapAroundMode : WrapAroundMode = WrapAroundMode .EnabledWhenSupported ,
109
110
attributionState : AttributionState = AttributionState (),
110
111
onViewpointChanged : (() -> Unit )? = null,
112
+ onNavigationChanged : ((isNavigating: Boolean ) -> Unit )? = null,
111
113
onMapRotationChanged : ((Double ) -> Unit )? = null,
112
114
onMapScaleChanged : ((Double ) -> Unit )? = null,
113
115
onSpatialReferenceChanged : ((spatialReference: SpatialReference ? ) -> Unit )? = null,
@@ -174,6 +176,7 @@ public fun MapView(
174
176
MapViewEventHandler (
175
177
mapView,
176
178
onViewpointChanged,
179
+ onNavigationChanged,
177
180
onMapRotationChanged,
178
181
onMapScaleChanged,
179
182
onSpatialReferenceChanged,
@@ -223,6 +226,7 @@ private fun AttributionStateHandler(mapView: MapView, attributionState: Attribut
223
226
private fun MapViewEventHandler (
224
227
mapView : MapView ,
225
228
onViewpointChanged : (() -> Unit )? ,
229
+ onNavigationChanged : ((isNavigating: Boolean ) -> Unit )? ,
226
230
onMapRotationChanged : ((Double ) -> Unit )? ,
227
231
onMapScaleChanged : ((Double ) -> Unit )? ,
228
232
onSpatialReferenceChanged : ((spatialReference: SpatialReference ? ) -> Unit )? ,
@@ -239,6 +243,7 @@ private fun MapViewEventHandler(
239
243
onDrawStatusChanged : ((DrawStatus ) -> Unit )?
240
244
) {
241
245
val currentViewPointChanged by rememberUpdatedState(onViewpointChanged)
246
+ val currentOnNavigationChanged by rememberUpdatedState(onNavigationChanged)
242
247
val currentOnMapRotationChanged by rememberUpdatedState(onMapRotationChanged)
243
248
val currentOnMapScaleChanged by rememberUpdatedState(onMapScaleChanged)
244
249
val currentOnSpatialReferenceChanged by rememberUpdatedState(onSpatialReferenceChanged)
@@ -275,6 +280,11 @@ private fun MapViewEventHandler(
275
280
currentOnSpatialReferenceChanged?.invoke(spatialReference)
276
281
}
277
282
}
283
+ launch {
284
+ mapView.navigationChanged.collect {
285
+ currentOnNavigationChanged?.invoke(it)
286
+ }
287
+ }
278
288
launch(Dispatchers .Main .immediate) {
279
289
mapView.isInteracting.collect { isInteracting ->
280
290
currentOnInteractingChanged?.invoke(isInteracting)
0 commit comments