By default, when I set the LocationDisplay.AutoPanMode to Recenter, the map automatically pans so that my current location sits at the center of the MapView control. Is it possible somehow to provide an X,Y offset to the MapView so that Runtime adjusts where it thinks the visual center is?
In my application, I sometimes display a panel of information that floats above the left side of the map. When this panel is open, I would like to shift the visual center of the map over to the right a certain amount to accommodate the panel.
I realize that I could split the screen vertically into into two separate sections - one for my panel and one for the map. Then I could hide the panel section when it's not needed and let the map consume the entirety of the screen. The downside to this approach is that 1) my panel doesn't usually need the full vertical portion of the screen and 2) there is a jarring effect as the map is repainted in the newly available space when the panel is closed, which gets worse if the panel is opened and closed a lot.
I'm using the ArcGIS Runtime SDK for .NET v100.8.
TheMapView.LocationDisplay.AutoPanMode = LocationDisplayAutoPanMode.Recenter
Thank you!
Solved! Go to Solution.
Yes! This is what the ViewInsets property on the MapView is made for. Let's say you have a 200px wide panel on the left overlapping your map view. In that case set the viewinsets to mapView.ViewInsets = new Thickness(200,0,0,0);
This will also help when you say zoom to a geometry, it'll take this inset into account, and keep the location you went to in view without getting hidden behind the overlapping panel. As you open/close the panel, just update the viewinsets.
Yes! This is what the ViewInsets property on the MapView is made for. Let's say you have a 200px wide panel on the left overlapping your map view. In that case set the viewinsets to mapView.ViewInsets = new Thickness(200,0,0,0);
This will also help when you say zoom to a geometry, it'll take this inset into account, and keep the location you went to in view without getting hidden behind the overlapping panel. As you open/close the panel, just update the viewinsets.
Is there an equivalent in the JS sdk?
I would suggest asking over in the JS forum where all the JS API experts hang out.
Thanks for the quick reply, Morten! That works great!