diff --git a/GoogleMapsComponents/Maps/Drawing/DrawingManager.cs b/GoogleMapsComponents/Maps/Drawing/DrawingManager.cs index 2ea9fddf..cd85c340 100644 --- a/GoogleMapsComponents/Maps/Drawing/DrawingManager.cs +++ b/GoogleMapsComponents/Maps/Drawing/DrawingManager.cs @@ -73,7 +73,7 @@ public Task SetDrawingMode(OverlayType? drawingMode) /// https://developers.google.com/maps/documentation/javascript/reference/drawing#DrawingManager.setMap /// /// - public async Task SetMap(Map map) + public async Task SetMap(Map? map) { await _jsObjectRef.InvokeAsync( "setMap", diff --git a/GoogleMapsComponents/wwwroot/js/objectManager.js b/GoogleMapsComponents/wwwroot/js/objectManager.js index af397c32..bda314dc 100644 --- a/GoogleMapsComponents/wwwroot/js/objectManager.js +++ b/GoogleMapsComponents/wwwroot/js/objectManager.js @@ -121,30 +121,29 @@ } } - if (item2 === "polyline" && item2 !== null) { - if (item.startsWith("google.maps.drawing.OverlayType")) { - switch (item) { - case "google.maps.drawing.OverlayType.CIRCLE": - item2 = google.maps.drawing.OverlayType.CIRCLE; - break; - case "google.maps.drawing.OverlayType.MARKER": - item2 = google.maps.drawing.OverlayType.MARKER; - break; - case "google.maps.drawing.OverlayType.POLYGON": - item2 = google.maps.drawing.OverlayType.POLYGON; - break; - case "google.maps.drawing.OverlayType.POLYLINE": - item2 = google.maps.drawing.OverlayType.POLYLINE; - break; - case "google.maps.drawing.OverlayType.RECTANGLE": - item2 = google.maps.drawing.OverlayType.RECTANGLE; - break; - default: - } - - return item2; + if (item !== null && item.startsWith("google.maps.drawing.OverlayType")) { + switch (item) { + case "google.maps.drawing.OverlayType.CIRCLE": + item2 = google.maps.drawing.OverlayType.CIRCLE; + break; + case "google.maps.drawing.OverlayType.MARKER": + item2 = google.maps.drawing.OverlayType.MARKER; + break; + case "google.maps.drawing.OverlayType.POLYGON": + item2 = google.maps.drawing.OverlayType.POLYGON; + break; + case "google.maps.drawing.OverlayType.POLYLINE": + item2 = google.maps.drawing.OverlayType.POLYLINE; + break; + case "google.maps.drawing.OverlayType.RECTANGLE": + item2 = google.maps.drawing.OverlayType.RECTANGLE; + break; + default: } + + return item2; } + if (typeof item2 === "object" && item2 !== null) { if ("guidString" in item2) { diff --git a/ServerSideDemo/Pages/DrawingManagerPage.razor b/ServerSideDemo/Pages/DrawingManagerPage.razor index 233c0b33..d71bd3cc 100644 --- a/ServerSideDemo/Pages/DrawingManagerPage.razor +++ b/ServerSideDemo/Pages/DrawingManagerPage.razor @@ -3,8 +3,9 @@