void HandlePaneStateChanged(InfoPane.State state) { var time = Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime); var enabled = state != InfoPane.State.FullyOpened; map.UiSettings.ScrollGesturesEnabled = enabled; map.UiSettings.ZoomGesturesEnabled = enabled; if (state == InfoPane.State.FullyOpened && currentShownMarker != null) { oldPosition = map.CameraPosition; var destX = mapFragment?.Width / 2; var destY = (mapFragment?.Height - pane.Height) / 2; var currentPoint = map.Projection.ToScreenLocation(currentShownMarker.Position); var scroll = CameraUpdateFactory.ScrollBy((float)-destX + (float)currentPoint.X, (float)-destY + (float)currentPoint.Y); map.AnimateCamera(scroll, time, null); } else if (oldPosition != null) { map.AnimateCamera(CameraUpdateFactory.NewCameraPosition(oldPosition), time, null); oldPosition = null; } }
void SetupInfoPane(View view) { pane = view.FindViewById <InfoPane>(Resource.Id.infoPane); pane.StateChanged += HandlePaneStateChanged; view.ViewTreeObserver.AddOnGlobalLayoutListener(this); }
void SetupInfoPane(View view) { pane = view.FindViewById<InfoPane>(Resource.Id.infoPane); pane.StateChanged += HandlePaneStateChanged; view.ViewTreeObserver.AddOnGlobalLayoutListener(this); }