I am using marker infoWindow to display info. It opens properly and does close when clicked somewhere on map.
initMap(){
.................
map.addListener('click', function () {
infowindow.close();
});
}
var infowindow;
.....
.............
function markerPushWithInfoWindow(marker) {
markers.push(marker);
infowindow = new google.maps.InfoWindow();
marker.addListener('click', function () {
if (infowindow) {
infowindow.close();
}
infowindow.setContent(this.info);
infowindow.open(map, marker);
});
}
markerPushWithInfoWindow is called() when marker is drawn during animation. The infoWindow doesn't close(when clicked outside the marker i.e. on map) while the animation is running, it closes only when the animation is paused.
Animation: We fetch the list of position(latitude/longtitude) data from the DB(particular date) and animate it via car.(Replay feature).