Select to view content in your preferred language

Detect drag gesture seem to prevent normal panning

319
1
12-11-2024 11:20 AM
JSFDemers
New Contributor

 

    Box {
        MapView(
            arcGISMap = arcGISMap, modifier = Modifier
                .fillMaxSize(), graphicsOverlays = graphicOverlays, mapViewProxy = mapViewProxy
        )
        Box(
            Modifier
                .fillMaxSize()
                .pointerInput(Unit) {
                    detectHorizontalDragGestures { change, dragAmount ->
                        if (isDragConsumed()) {
                            change.consume()
                            Log.d(TAG, "do drag here ")
                        }
                    }
                })
    }

 

Here a little sample of what I'm trying to achieve. I put a dummy invisible to catch the drag event and do something. I'm not sure why, but it seem to break the pan event when isDragConsumed is not trigger.

Tags (2)
0 Kudos
1 Reply
Erick_1
Esri Contributor

Hello, 

In the code provided, you're putting two composables ( MapView and inner Box) inside a Box which causes both elements to be stacked on top of each other. This is why inner Box is consuming the events and it breaks the map panning. 

Are you specifically looking to intercept horizontal gestures? 

We provide a lambda on MapView that might work. 

onPan: ((PanChangeEvent) -> Unit)? = null
0 Kudos