@@ -444,7 +444,7 @@ public async ValueTask AddHtmlMarkersAsync(IEnumerable<HtmlMarker> markers)
444444 if ( markers != null )
445445 {
446446 _logger ? . LogAzureMapsControlInfo ( AzureMapLogEvent . Map_AddHtmlMarkersAsync , "Adding html markers" ) ;
447- HtmlMarkers = ( HtmlMarkers ?? Array . Empty < HtmlMarker > ( ) ) . Concat ( markers ) ;
447+ HtmlMarkers = ( HtmlMarkers ?? Array . Empty < HtmlMarker > ( ) ) . Concat ( markers ) . ToArray ( ) ;
448448 _logger ? . LogAzureMapsControlInfo ( AzureMapLogEvent . Map_AddHtmlMarkersAsync , $ "{ markers . Count ( ) } new html markers will be added") ;
449449 var parameters = GetHtmlMarkersCreationParameters ( markers ) ;
450450 await _jsRuntime . InvokeVoidAsync ( Constants . JsConstants . Methods . Core . AddHtmlMarkers . ToCoreNamespace ( ) ,
@@ -530,6 +530,48 @@ await _jsRuntime.InvokeVoidAsync(Constants.JsConstants.Methods.Core.UpdateHtmlMa
530530 } : null
531531 } ) ) ;
532532
533+ foreach ( var updateWithOptions in updates . Where ( u => u . Options != null ) )
534+ {
535+ var targetMarker = HtmlMarkers . First ( marker => marker . Id == updateWithOptions . Marker . Id ) ;
536+
537+ if ( updateWithOptions . Options . Anchor . ToString ( ) != null )
538+ {
539+ targetMarker . Options . Anchor = updateWithOptions . Options . Anchor ;
540+ }
541+ if ( updateWithOptions . Options . Color != null )
542+ {
543+ targetMarker . Options . Color = updateWithOptions . Options . Color ;
544+ }
545+ if ( updateWithOptions . Options . Draggable != null )
546+ {
547+ targetMarker . Options . Draggable = updateWithOptions . Options . Draggable ;
548+ }
549+ if ( updateWithOptions . Options . HtmlContent != null )
550+ {
551+ targetMarker . Options . HtmlContent = updateWithOptions . Options . HtmlContent ;
552+ }
553+ if ( updateWithOptions . Options . Position != null )
554+ {
555+ targetMarker . Options . Position = updateWithOptions . Options . Position ;
556+ }
557+ if ( updateWithOptions . Options . PixelOffset != null )
558+ {
559+ targetMarker . Options . PixelOffset = updateWithOptions . Options . PixelOffset ;
560+ }
561+ if ( updateWithOptions . Options . SecondaryColor != null )
562+ {
563+ targetMarker . Options . SecondaryColor = updateWithOptions . Options . SecondaryColor ;
564+ }
565+ if ( updateWithOptions . Options . Text != null )
566+ {
567+ targetMarker . Options . Text = updateWithOptions . Options . Text ;
568+ }
569+ if ( updateWithOptions . Options . Visible != null )
570+ {
571+ targetMarker . Options . Visible = updateWithOptions . Options . Visible ;
572+ }
573+ }
574+
533575 foreach ( var updateWithPopup in updates . Where ( update => update . Options ? . Popup != null ) )
534576 {
535577 var marker = HtmlMarkers . First ( marker => marker . Id == updateWithPopup . Marker . Id ) ;
@@ -565,7 +607,7 @@ public async ValueTask RemoveHtmlMarkersAsync(IEnumerable<HtmlMarker> markers)
565607 _logger ? . LogAzureMapsControlInfo ( AzureMapLogEvent . Map_RemoveHtmlMarkersAsync , "Removing html markers" ) ;
566608 if ( HtmlMarkers != null && markers != null )
567609 {
568- HtmlMarkers = HtmlMarkers . Where ( marker => markers . Any ( m => m != null && m . Id != marker . Id ) ) ;
610+ HtmlMarkers = HtmlMarkers . Where ( marker => ! markers . Any ( m => m != null && m . Id == marker . Id ) ) . ToArray ( ) ;
569611 _logger ? . LogAzureMapsControlDebug ( AzureMapLogEvent . Map_RemoveHtmlMarkersAsync , $ "{ markers . Count ( ) } html markers will be removed") ;
570612 var ids = markers . Select ( marker => marker . Id ) ;
571613 _logger ? . LogAzureMapsControlDebug ( AzureMapLogEvent . Map_RemoveHtmlMarkersAsync , $ "Ids: { string . Join ( '|' , ids ) } ") ;
0 commit comments