rungwiroon / BlazorGoogleMaps

Blazor interop for GoogleMap library
MIT License
309 stars 99 forks source link

Add Custom Control Removal Functionality #296

Closed cruiserkernan closed 7 months ago

cruiserkernan commented 7 months ago

Description

This pull request introduces the implementation of a new feature for the BlazorGoogleMaps library, enabling the removal of custom controls from the map. This enhancement aligns with the feature request submitted earlier. The changes include the addition of RemoveControl and RemoveAllControls methods in the Map.cs class for dynamic control management.

Implemented Changes

  1. Map.cs:

    • Added RemoveControl(ControlPosition controlPosition, ElementReference elementReference) for removing a specific control based on its position and element reference.
    • Added RemoveAllControls(ControlPosition controlPosition) for removing all controls at a given position.
  2. objectManager.js:

    • Updated to support the new control removal functionality.
    • Updated AddControl to clone the elementReference. Without this the original element is removed and can not be added again.
  3. Razor Components:

    • Modified to demonstrate the new methods for adding and removing controls on the map.

Impact

I'm looking forward to the review and hopeful integration of this new functionality into the BlazorGoogleMaps library.

Thank you for considering this pull request!

cruiserkernan commented 7 months ago

This is the implementation for #295

valentasm1 commented 7 months ago

Looks good. Big thumb up for demo. I have just minor additions. I will update by myself. Map.cs methods. I would name RemoveControl and RemoveControls. Would do same in js. Also would add comment to js why i do clone.

cruiserkernan commented 7 months ago

Thanks! Yeah that is a good idea. And thanks for the quick releases!