Reputation: 636
I've added an OverlayView to the map. I have a lot of different markers on map. I allow clicking drawn objects on the canvas, but i don't want to allow clicking any shape / marker on the map while the overlay object's enabled property it true.
How can i do that? without keeping track of ALL the markers/ shapes/ (could be a lot!) and then running on each of them , removing the click listener and at the end adding it..
Thanks
Upvotes: 2
Views: 292
Reputation: 156
Create a variable overlayEnabled
and update it every time you enable/disable the overlay. Then in your click listeners, check that variable before performing any action.
google.maps.event.addListener(marker, 'click', function(e) {
if(overlayEnabled) {
// perform action
} else {
// do nothing
}
});
Upvotes: 1