Skip to content

Commit

Permalink
some map updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitry-bym committed Feb 7, 2024
1 parent d49f03c commit 2ec5094
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/GenOne.Blazor.Map/src/Component/Map.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,15 @@ public async Task ViewAllMarkers(bool flyTo = true, int? zoom = null)
switch (MarkerPosition is not null, ConsumerLocation is not null)
{
case (true, true):
var bounds = GeoBounds.FromLocations(MarkerPosition!, ConsumerLocation!.Location);
await _map.FlyToBounds(bounds.LatLngBounds());
var bounds = GeoBounds.FromLocations(MarkerPosition!, ConsumerLocation!.Location).LatLngBounds();
if (flyTo)
{
await _map.FlyToBounds(bounds);
}
else
{
await _map.FitBounds(bounds);
}
break;

case (true, false):
Expand Down
7 changes: 6 additions & 1 deletion src/GenOne.Blazor.Map/src/EventedExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ public static Task OnDragStart(this Evented evented, Func<MouseEvent, Task> call
return evented.On("dragstart", callback);
}

public static Task OnMoveEnd(this Evented evented, Func<MouseEvent, Task> callback)
public static Task OnZoomStart(this Evented evented, Func<MouseEvent, Task> callback)
{
return evented.On("zoomstart", callback);
}

public static Task OnMoveEnd(this Evented evented, Func<MouseEvent, Task> callback)
{
return evented.On("moveend", callback);
}
Expand Down
1 change: 1 addition & 0 deletions src/GenOne.Blazor.Map/src/IMapIconFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace GenOne.Blazor.Map;

//todo better to split factories and use delegates
public interface IMapIconFactory
{
Task<MarkerOptions> PrepareMarkerOptions(bool draggable);
Expand Down

0 comments on commit 2ec5094

Please sign in to comment.