Beispiel #1
0
        private void OnLayersChanged(object sender, NotifyCollectionChangedEventArgs args)
        {
            if (args.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (var item in args.NewItems)
                {
                    var layer = item as Layer;
                    LeafletInterops.AddLayer(_jsRuntime, Id, layer);
                }
            }
            else if (args.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (var item in args.OldItems)
                {
                    if (item is Layer layer)
                    {
                        LeafletInterops.RemoveLayer(_jsRuntime, Id, layer.Id);
                    }
                }
            }
            else if (args.Action == NotifyCollectionChangedAction.Replace ||
                     args.Action == NotifyCollectionChangedAction.Move)
            {
                foreach (var oldItem in args.OldItems)
                {
                    if (oldItem is Layer layer)
                    {
                        LeafletInterops.RemoveLayer(_jsRuntime, Id, layer.Id);
                    }
                }

                foreach (var newItem in args.NewItems)
                {
                    LeafletInterops.AddLayer(_jsRuntime, Id, newItem as Layer);
                }
            }
        }
Beispiel #2
0
 public void PanTo(PointF position, bool animate = false, float duration = 0.25f, float easeLinearity = 0.25f, bool noMoveStart = false)
 {
     LeafletInterops.PanTo(_jsRuntime, Id, position, animate, duration, easeLinearity, noMoveStart);
 }
Beispiel #3
0
 public void FitBounds(PointF corner1, PointF corner2, PointF?padding = null, float?maxZoom = null)
 {
     LeafletInterops.FitBounds(_jsRuntime, Id, corner1, corner2, padding, maxZoom);
 }
Beispiel #4
0
 /// <summary>
 /// Decreases the zoom level by one notch.
 ///
 /// If <c>shift</c> is held down, decreases it by three.
 /// </summary>
 public async Task ZoomOut(MouseEventArgs e) => await LeafletInterops.ZoomOut(_jsRuntime, Id, e);
Beispiel #5
0
 public async Task <float> GetZoom() =>
 await LeafletInterops.GetZoom(_jsRuntime, Id);
Beispiel #6
0
 public async Task <LatLng> GetCenter() => await LeafletInterops.GetCenter(_jsRuntime, Id);
Beispiel #7
0
 public async Task <Bounds> GetBounds() => await LeafletInterops.GetBounds(_jsRuntime, Id);
Beispiel #8
0
 public ValueTask <Bounds> GetBoundsFromMarkers(params Marker[] markers)
 => LeafletInterops.GetBoundsFromMarkers(_jsRuntime, markers);
Beispiel #9
0
 public ValueTask FitBounds(Bounds bounds, PointF?padding = null, float?maxZoom = null)
 {
     return(LeafletInterops.FitBounds(_jsRuntime, Id, new PointF(bounds.NorthEast.Lat, bounds.NorthEast.Lng),
                                      new PointF(bounds.SouthWest.Lat, bounds.SouthWest.Lng), padding, maxZoom));
 }
Beispiel #10
0
 public ValueTask FitBounds(PointF corner1, PointF corner2, PointF?padding = null, float?maxZoom = null)
 {
     return(LeafletInterops.FitBounds(_jsRuntime, Id, corner1, corner2, padding, maxZoom));
 }
Beispiel #11
0
 public ValueTask OpenMarkerPopup(Marker marker) => LeafletInterops.OpenLayerPopup(_jsRuntime, Id, marker);