rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
309 stars 99 forks source link

Add class DragEndEvent for dragend listener (Suggestion) #321

Closed jacksonsfaria closed 4 months ago

jacksonsfaria commented 4 months ago

Returned by drangend listener {"latLng":{"lat":-23.703340477909656,"lng":-46.869214057922356},"domEvent":{"isTrusted":true},"pixel":{"x":108,"y":-50}}

// I didn't find this class on [BlazorGoogleMaps](https://github.com/rungwiroon/BlazorGoogleMaps)
 public class DomEvent
 {
     public bool IsTrusted { get; set; }
 }

// Class for AddListener dragend
 public class DragEndEvent
 {
     public LatLngLiteral LatLng { get; set; }
     public Point Pixel { get; set; }
     public DomEvent DomEvent { get; set; }
 }

How use... await marker.AddListener<DragEndEvent>("dragend", (e) => OnDragEndDistribution(e));

public void OnDragEndDistribution(DragEndEvent e)
{
      Console.WriteLine(e.LatLng.Lat + " " + e.LatLng.Lng);
}
valentasm1 commented 4 months ago

Added to. Thank you for suggestion https://www.nuget.org/packages/BlazorGoogleMaps/4.1.1