Skip to content

Commit

Permalink
Merge pull request #207 from markschroeder77/master
Browse files Browse the repository at this point in the history
remove marker from cluster fix
  • Loading branch information
valentasm1 authored Aug 27, 2022
2 parents 0b5feb9 + 37242cd commit d167be7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions GoogleMapsComponents/Maps/Extension/MarkerList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,24 @@ public Task<Dictionary<string, int>> GetZIndexes(List<string> filterKeys = null)
/// Passing in null will cause any animation to stop.
/// </summary>
/// <param name="animation"></param>
public Task SetAnimations(Dictionary<string, Animation> animations)
public Task SetAnimations(Dictionary<string, Animation?> animations)
{
Dictionary<Guid, object> dictArgs = animations.ToDictionary(e => Markers[e.Key].Guid, e => (object)e.Value);
Dictionary<Guid, object?> dictArgs = animations.ToDictionary(e => Markers[e.Key].Guid, e => (object?)GetAnimationCode(e.Value));
return _jsObjectRef.InvokeMultipleAsync(
"setAnimation",
dictArgs);
}

public int? GetAnimationCode(Animation? animation)
{
switch (animation)
{
case null: return null;
case Animation.Bounce: return 1;
case Animation.Drop: return 2;
default: return 0;
}
}

/// <summary>
/// Sets the Clickable flag of one or more Markers to match a dictionary of marker keys and flag values.
Expand Down
2 changes: 1 addition & 1 deletion GoogleMapsComponents/Maps/MarkerClustering.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public virtual async Task SetMap(Map map)
/// </summary>
public virtual async Task RemoveMarkers(IEnumerable<Marker> markers, bool noDraw = false)
{
await _jsObjectRef.InvokeAsync("removeMarkers", markers, noDraw);
await _jsObjectRef.JSRuntime.InvokeVoidAsync("googleMapsObjectManager.removeClusteringMarkers", _jsObjectRef.Guid.ToString(), markers, noDraw);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion GoogleMapsComponents/wwwroot/js/objectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ window.googleMapsObjectManager = {
return window._blazorGoogleMapsObjects[marker.guid];
});

window._blazorGoogleMapsObjects[guid].addMarkers(originalMarkers, noDraw);
window._blazorGoogleMapsObjects[guid].removeMarkers(originalMarkers, noDraw);
},

addClusteringMarkers(guid, markers, noDraw) {
Expand Down

0 comments on commit d167be7

Please sign in to comment.