private void OnCameraIdle(object sender, EventArgs e) { cameraBusy = false; currentCamera = new NxLatLng(map.CameraPosition.Target.Latitude, map.CameraPosition.Target.Longitude); Element.ZoomLevel = map.CameraPosition.Zoom; Element.Center = currentCamera; }
public bool OnMapClick(LatLng p0) { var point = map.Projection.ToScreenLocation(p0); var xfPoint = new Xamarin.Forms.Point(point.X, point.Y); var xfPosition = new NxLatLng(p0.Latitude, p0.Longitude); (NxLatLng, Xamarin.Forms.Point)commandParamters = (xfPosition, xfPoint); if (Element.DidTapOnMapCommand?.CanExecute(commandParamters) == true) { Element.DidTapOnMapCommand.Execute(commandParamters); } // TODO should return true return(false); }
protected override void OnElementChanged(ElementChangedEventArgs <MapView> e) { base.OnElementChanged(e); if (e.OldElement != null) { e.OldElement.AnnotationsChanged -= Element_AnnotationsChanged; e.OldElement.Functions = null; if (map != null) { RemoveMapEvents(); } } if (e.NewElement == null) { return; } if (Control == null) { var activity = (AppCompatActivity)Context.GetActivity(); var view = new Android.Widget.FrameLayout(activity) { Id = GenerateViewId() }; SetNativeControl(view); fragment = MapViewFragment.Create(Element, Context); activity.SupportFragmentManager .BeginTransaction() .Replace(view.Id, fragment) .CommitAllowingStateLoss(); fragment.GetMapAsync(this); currentCamera = new NxLatLng(); } }
public static LatLng ToLatLng(this NxLatLng pos) { return(new LatLng(pos.Lat, pos.Long)); }