GoogleWebComponents / google-map

Google Maps web components

Home Page:https://elements.polymer-project.org/elements/google-map

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

singleInfoWindow attribute doesn't work [2.0-preview]

jonadeline opened this issue · comments

Hi there,

The singleInfoWindowdoesn't seem to have any effect on infoWindow behavior. When clicking a marker all the previous opened info windows remain open.
This behavior has been experienced using 2.0-preview branch of google-map component.

Here is a JSBin demonstrating the issue : https://jsbin.com/qiboluq/edit?html,console,output

Here is a workaround in case someone needs one :

<google-map-marker on-google-map-marker-click="_handleMarkerClick">
_handleMarkerClick(event) {
    const currentMarker = event.currentTarget;
    const gmapMarkerEls = this.shadowRoot.querySelectorAll('google-map-marker');
    gmapMarkerEls.forEach((gmapMarker) => {
      if (currentMarker !== gmapMarker) {
        gmapMarker.info.close();
      }
    });
}

My bad it works correctly.