Select to view content in your preferred language

Migrate gesture from SDK 100 to 200

270
0
01-14-2025 06:50 AM
JR1S
by
New Contributor

For example, with the old SDK (100) I had a few actions on the double tap. In one case, I do something and return true to indicate that there's no zoom and the event is consumed, otherwise I use the default behaviour and return false.

 

mapView.onTouchListener = object : DefaultMapViewOnTouchListener(applicationContext, mapView) {
  override fun onDoubleTap(e: MotionEvent) : Boolean {
    if(bIntercept)
    {
      // actions to do and no zoom in
      return true
    }
    // default behaviour : zoom in
    return super.onDoubleTap(motionEvent)
  }
}

 

 


Is it possible to do the same thing with the new API 200.6.0 ?

I tried this because of what is recommended by esri for migration (https://developers.arcgis.com/kotlin/reference/migrate-from-100-x-to-200-x/#gestures)

 

 

 

 

lifecycleScope.launch {
  mapView.onDoubleTap.collect { event ->
  // actions to do or default behaviour
  }
}

 

 

 

 


but I don't know if there's a way of telling the mapview that the event has been consumed sometimes. Because whatever I've tried, the default behaviour (zoom in) is applied and there is no return value. same with other events (tap, drag, scale)
Note: the mapview in my case is a view, not a compose

0 Kudos
0 Replies