map-icons
map-icons copied to clipboard
setVisible(false) not applied for labels
Hi! When i try to hide markers using default marker.setVisible(false) function - markers are hidden but labels still shown on the map
I have the same issue, did you find a workaround?
I have different types of markers, so init them in this way:
...
var labelClass = 'some_class_name';
var labelHTML = '<i class="' + labelClass + '"></i>';
var marker = new Marker({
map: appMap,
position: place.geometry.location,
zIndex: 9,
icon: {
path: SQUARE_PIN
},
label: labelHTML
});
Then add zoom handlers:
...
google.maps.event.addListener(appMap, 'zoom_changed', function() {
setTimeout(function() {
if (markersAreHidden) { // special flag
$('#myMap').find('.' + labelClass).parent().hide();
}
}, 100);
});
Not the most elegant solution but it works for now.
This needs a proper fix.