Is there a way in ArcGIS Runtime 100.1.0 to turn off the map rotation? When use pinch gesture it rotates the map view is there a way to disable that? In ArcGIS 10.2.9 you there was a function mapView.setAllowRotationByPinch(boolean). Does something like that exist in 100.1.0?
I passed this along to our development team. One thing that was suggested to me by them was to override the DefaultMapTouchListener::OnRotation() method so it does not call the super() method. I have not had a chance to test this as of yet, but when I get some more time, I can test / write a extension function in Kotlin for this.
package com.arcgis.apps.rotate
import android.content.Context
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.MotionEvent
import com.esri.arcgisruntime.mapping.ArcGISMap
import com.esri.arcgisruntime.mapping.Basemap
import com.esri.arcgisruntime.mapping.view.DefaultMapViewOnTouchListener
import com.esri.arcgisruntime.mapping.view.MapView
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
val map = ArcGISMap(Basemap.createDarkGrayCanvasVector())
val mapV = findViewById(R.id.mapView) as MapView
mapV.map = map
mapV.DisableRotation()
}
fun MapView.DisableRotation() {
this.onTouchListener = NoRotate(this.context, this)
}
private inner class NoRotate(context: Context, mapView: MapView) : DefaultMapViewOnTouchListener(context, mapView) {
override fun onRotate(event: MotionEvent, rotationAngle: Double): Boolean {
Log.e("NOHE", "ROTATED")
return true
}
override fun onLongPress(e: MotionEvent) {
Log.e("NOHE", "SANITY")
super.onLongPress(e)
}
}
}
This is a sample in kotlin showing how to disable map rotation.
Hope this helps!