Select to view content in your preferred language

ViewInsets not centering map point when left panel is present

1010
1
11-07-2017 09:33 AM
WilliamLockwood
Emerging Contributor

Using ArcGIS Runtime SDK for .NET - Version: 100.1.0.0, I am trying to use the GeoView.ViewInsets property to properly center a map point when a panel pulls out from the left. I am doing this by setting mapview.ViewInsets = new Thickness(panelWidth, 0, 0, 0), with mapView being a MapView.

 

However, when I call await mapView.SetViewpointCenterAsync after setting the ViewInsets, it is still centering the map point on the map as if the panel isn't there. When I put a breakpoint there I can see that the ViewInsets have been set to what I want, and even when I change different parts of the ViewInsets it still centers in the same place. 

 

Is SetViewpointCenterAsync the correct method to call if I want to center a point properly, taking the ViewInsets into account, or is there a different method I should be using? If it is the proper method, what else could be causing this not to center correctly?

 

I’ve attached a rough illustration of what’s going on.

 

The black represents the panel

The green represents the map

The red dot represents the map point that should be centered in relation to the map area

Tags (2)
0 Kudos
1 Reply
dotMorten_esri
Esri Notable Contributor

I believe you might be hitting a 100.1 bug where calling setviewpointasync immediately after updating the viewinsets has no effect. Try adding a small delay between setting the insets and calling setviewpointasync, and see if that doesn't workaround the problem.

The delay should be about how long it takes for the mapview to complete a render cycle (usually 16-32ms depending on the framerate, so set it a little higher than this to make sure)