Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setVisible(false) not applied for labels #25

Open
Sunsvision opened this issue Jun 25, 2015 · 3 comments
Open

setVisible(false) not applied for labels #25

Sunsvision opened this issue Jun 25, 2015 · 3 comments

Comments

@Sunsvision
Copy link

Hi! When i try to hide markers using default marker.setVisible(false) function - markers are hidden but labels still shown on the map

@jakeholland
Copy link

I have the same issue, did you find a workaround?

@Sunsvision
Copy link
Author

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.

@bojanvidanovic
Copy link

This needs a proper fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants