rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
331 stars 105 forks source link

Enum parsing do not return correct result for drawing manager GetDrawingMode #242

Closed marco-manfroni closed 1 year ago

marco-manfroni commented 1 year ago

Hi and thanks for this great porting of google maps to blazor. Can you add the support for detecting when the user changes between each drawing overlay type (marked, polygon, circle, etc..)? I tried with these codes, but the event is not called.

await googleMap.InteropObject.AddListener("drawingmode_changed", async (e) => await OnModeChangedClick(e)); await drawingManager.AddListener("drawingmode_changed", async (e) => await OnModeChangedClick(e));

This shows the desired behaviour logging the change to the console https://jsfiddle.net/geocodezip/7f41wx2h

Thanks Marco

valentasm1 commented 1 year ago

I will take a look this or next weekend.

valentasm1 commented 1 year ago

First you did wrong. Jsfiddle shows that event drawingmode_changed do not return anything (couldnt find official reference since i am lazy). Even when i do correct then GetDrawingMode returns wrong results. Always default. I fixed enum parsing and now it return good. https://github.com/rungwiroon/BlazorGoogleMaps/blob/master/ServerSideDemo/Pages/DrawingManagerPage.razor.cs#L88 https://www.nuget.org/packages/BlazorGoogleMaps/2.5.4