Closed EGInsider closed 1 month ago
Found issue. Will release fix soon.
I feel really bad of releasing such bug. We just did some changes to advanced marked and forgot to test it. Sorry and let me know if this version works better https://www.nuget.org/packages/BlazorGoogleMaps/4.4.1
@valentasm1 Thanks for resolving the issue.
@valentasm1 the issue still persists when we use a list of markers instead of a single marker
@valentasm1
Sample code from my project :
if (markerList == null)
{
markerList = await AdvancedMarkerElementList.CreateAsync(this.Map.JsRuntime, cordDic);
}
else
{
await markerList.AddMultipleAsync(cordDic);
}
ig CreateAsync
and AddMultipleAsync
are the root cause
I updated server side demo. It works for me. What error appears in console for you?
Also one more issue that AdvancedMarker dont have nor Draggable, nor Visible properties, so if you set them then map will fail. Not very sure how to solve it since it need some refactoring. Maybe ovveride them and throw exception of trying to set. We did bad architecture in this case
@valentasm1 I'm getting the same error as above content
invalid not an instance of Node.
Yes you're right the above mentioned properties aren't present in AdvanceMarkerElement class
Here's my sample code that throws out the same content invalid error
var cordDic = this.checkins
.Where(x => selectedAgentsAndLocations.Any() ? (selectedAgentsAndLocations.Contains(x.city) || selectedAgentsAndLocations.Contains(x.user_name)) : true)
.ToDictionary(x => Guid.NewGuid().ToString(), x =>
{
var label = $" {x.user_name} ({x.created_at:dMMM h:mtt})";
return new AdvancedMarkerElementOptions
{
Position = new LatLngLiteral() { Lng = (double)x.@long, Lat = (double)x.lat },
Map = this.Map.InteropObject,
Title = x.address_line,
Content = label.GetMarkerHtml("http://maps.google.com/mapfiles/kml/shapes/man.png"),
};
});
if (markerList == null)
{
markerList = await AdvancedMarkerElementList.CreateAsync(this.Map.JsRuntime, cordDic);
}
else
{
await markerList.AddMultipleAsync(cordDic);
}
public static string GetMarkerHtml(this string label, string imgSource = null)
{
var html = $@"<div style='grid-area: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 8px; height: 8px;'>
<img src={imgSource} aria-hidden='true' height='40px' width='40px'>
<div class='fa-sr-only' style=""color: #00FFD1; font-weight: bold; font-family: 'Trebuchet MS';"">{label}</div>
</div>";
return html;
}
@valentasm1 ig a page to simulate AdvancedMarkerElementList can be implemented
You are right. Demo was without content. Fixed https://www.nuget.org/packages/BlazorGoogleMaps/4.4.2
@valentasm1 Thanks! for the help
@valentasm1 I'm using recently implemented
AdvancedMarkerElement
class in my code and settingAdvancedMarkerElementOptions.Content = HTML element
but I'm getting the errorUnhandled exception rendering component: AdvancedMarkerElement: "content" invalid: not an instance of Node;
Sample Code: