From 7cd8b83ee04da0ba04eaffa3c1c5b542c6b39859 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Mon, 23 Oct 2023 16:59:16 -0700 Subject: [PATCH 1/4] added mapViewInteractionOptions --- .../src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt index 3f8c2441f..cbb6611e8 100644 --- a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt +++ b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt @@ -30,6 +30,7 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.viewinterop.AndroidView import com.arcgismaps.mapping.ArcGISMap import com.arcgismaps.mapping.view.MapView +import com.arcgismaps.mapping.view.MapViewInteractionOptions /** * A compose equivalent of the [MapView]. @@ -43,14 +44,19 @@ import com.arcgismaps.mapping.view.MapView public fun Map( modifier: Modifier = Modifier, arcGISMap: ArcGISMap? = null, + mapViewInteractionOptions: MapViewInteractionOptions? = null, overlay: @Composable () -> Unit = {} ) { val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current val mapView = remember { MapView(context) }.apply { map = arcGISMap + if (mapViewInteractionOptions != null) { + interactionOptions = mapViewInteractionOptions + } } + Box(modifier = Modifier.semantics { contentDescription = "MapContainer" }) { From 84df6e1dbc3e73eb915462256a255a39648a3b4f Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Tue, 24 Oct 2023 10:46:16 -0700 Subject: [PATCH 2/4] Add MapViewInteractionOptionDefaults --- .../com/arcgismaps/toolkit/geocompose/Map.kt | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt index cbb6611e8..5608ec10a 100644 --- a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt +++ b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt @@ -32,6 +32,8 @@ import com.arcgismaps.mapping.ArcGISMap import com.arcgismaps.mapping.view.MapView import com.arcgismaps.mapping.view.MapViewInteractionOptions +public val MapViewInteractionOptionDefaults: MapViewInteractionOptions = MapViewInteractionOptions() + /** * A compose equivalent of the [MapView]. * @@ -44,18 +46,12 @@ import com.arcgismaps.mapping.view.MapViewInteractionOptions public fun Map( modifier: Modifier = Modifier, arcGISMap: ArcGISMap? = null, - mapViewInteractionOptions: MapViewInteractionOptions? = null, + mapViewInteractionOptions: MapViewInteractionOptions = MapViewInteractionOptionDefaults, overlay: @Composable () -> Unit = {} ) { val lifecycleOwner = LocalLifecycleOwner.current val context = LocalContext.current - val mapView = remember { MapView(context) }.apply { - map = arcGISMap - if (mapViewInteractionOptions != null) { - interactionOptions = mapViewInteractionOptions - } - } - + val mapView = remember { MapView(context) } Box(modifier = Modifier.semantics { contentDescription = "MapContainer" @@ -63,7 +59,12 @@ public fun Map( AndroidView(modifier = modifier .semantics { contentDescription = "MapView" - }, factory = { mapView }) + }, + factory = { mapView }, + update = { + it.map = arcGISMap + it.interactionOptions = mapViewInteractionOptions + }) overlay() } From 9ad953d53a7d3e53b7c9b33e1e0650a18b4eeab0 Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Tue, 24 Oct 2023 14:53:18 -0700 Subject: [PATCH 3/4] add doc --- .../src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt index 5f31f8d46..4155ea6ec 100644 --- a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt +++ b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt @@ -38,6 +38,9 @@ import com.arcgismaps.mapping.view.MapView import com.arcgismaps.mapping.view.MapViewInteractionOptions import kotlinx.coroutines.launch +/** + * The default instance of [MapViewInteractionOptions] + */ public val MapViewInteractionOptionDefaults: MapViewInteractionOptions = MapViewInteractionOptions() /** @@ -46,6 +49,7 @@ public val MapViewInteractionOptionDefaults: MapViewInteractionOptions = MapView * @param modifier Modifier to be applied to the Map * @param arcGISMap the [ArcGISMap] to be rendered by this composable * @param locationDisplay the [LocationDisplay] used by the composable [com.arcgismaps.toolkit.geocompose.Map] + * @param mapViewInteractionOptions the state of this Map's interaction options * @param onViewpointChanged lambda invoked when the viewpoint of the Map has changed * @param overlay the composable overlays to display on top of the Map. Example, a compass, floorfilter etc. * @since 200.3.0 From 4a53dbc5dd934622e86a9bf5d9f9170bb2eec51e Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Tue, 24 Oct 2023 15:29:53 -0700 Subject: [PATCH 4/4] Updated param doc --- .../src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt index 4155ea6ec..423208a86 100644 --- a/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt +++ b/toolkit/geo-compose/src/main/java/com/arcgismaps/toolkit/geocompose/Map.kt @@ -49,7 +49,7 @@ public val MapViewInteractionOptionDefaults: MapViewInteractionOptions = MapView * @param modifier Modifier to be applied to the Map * @param arcGISMap the [ArcGISMap] to be rendered by this composable * @param locationDisplay the [LocationDisplay] used by the composable [com.arcgismaps.toolkit.geocompose.Map] - * @param mapViewInteractionOptions the state of this Map's interaction options + * @param mapViewInteractionOptions the [MapViewInteractionOptions] used by this composable [com.arcgismaps.toolkit.geocompose.Map] * @param onViewpointChanged lambda invoked when the viewpoint of the Map has changed * @param overlay the composable overlays to display on top of the Map. Example, a compass, floorfilter etc. * @since 200.3.0