-
Notifications
You must be signed in to change notification settings - Fork 130
Description
Hi all,
I've recently started using Mapstraction at work, so I'm not quite familiar with the interface, but I think I've found what could be considered a bad behavior.
We are currently using Google Maps V3, putting many markers over a map, and adding an infoWindow to each of them. As you know, V3 allows you to have many infowindows shown at the same time, but that is not a behavior we want to have, so I wrote a code like this:
function openLayer(event, marker) {
map.markers.forEach(function(marker) {
marker.closeBubble();
});
marker.openBubble();
}Testing this code, I found that, on the first click, two layers are created for the same marker, thus making impossible to close the first one. After digging in the code, I found the following snippet:
if (this.infoBubble) {
var event_action = "click";
if (this.hover) {
event_action = "mouseover";
}
google.maps.event.addListener(marker, event_action, function() {
marker.mapstraction_marker.openBubble();
});
}Which is automatically adding a listener for showing the layer. If I comment the handler, everything works fine. I could not trace why the info window is created twice.
But, apart from this, should mapstraction add default handlers? I think it would be better if this is explicitly done rather than implicitly.