-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Describe the bug
RemoveHtmlMarkersAsync() accepts a params array of markers, but it only removes the first marker passed in.
To Reproduce
@page "/Markers/HtmlMarkersRemove"
@rendermode InteractiveServer
@using AzureMapsControl.Components.Markers
@using AzureMapsControl.Components.Atlas
@using AzureMapsControl.Components.Map
<AzureMap Id="map"
EventActivationFlags="MapEventActivationFlags
.None()
.Enable(MapEventType.Click, MapEventType.Load)"
OnClick="OnMapClick" OnLoad="OnMapLoad" />
@code
{
private List<HtmlMarker> Markers = new List<HtmlMarker>();
public async Task OnMapLoad(MapEventArgs eventArgs)
{
for(int i = 0; i < 10; i++)
{
Markers.Add(new HtmlMarker(new HtmlMarkerOptions
{
Position = new Position(47.3769 + i, 8.5417 + i)
}, HtmlMarkerEventActivationFlags.None()));
}
}
public bool Added = false;
public async Task OnMapClick(MapMouseEventArgs eventArgs)
{
if (Added)
{
// foreach (var marker in Markers)
// {
// await eventArgs.Map.RemoveHtmlMarkersAsync(marker);
// }
await eventArgs.Map.RemoveHtmlMarkersAsync(Markers);
}
else
{
await eventArgs.Map.AddHtmlMarkersAsync(Markers);
}
Added = !Added;
}
}
Clicking once on the map adds 10 markers. Clicking again on the map only removes one marker. Replace the bulk operations with the loop version (currently commented out) and see that it works as expected.
Expected behavior
RemoveHtmlMarkersAsync() should remove all the markers that are passed in.
Desktop (please complete the following information):
- OS: Windows 10 Home
- Browser: Firefox (latest)
- Version: 1.16.1
Additional context
The console output correctly indicates that all 10 items are removed, but the visual on the map only removes the first. I have not confirmed that this isn't an issue with azure maps. I believe AddHtmlMarkersAsync() and UpdateHtmlMarkersAsync() are working correctly.