Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

unbindLabel followed by bindLabel doesn't re-render labels until I zoom out and in #126

Open
TheSisb opened this issue Aug 27, 2015 · 1 comment

Comments

@TheSisb
Copy link

TheSisb commented Aug 27, 2015

I've got a markercluster with labels that are noHide: true (always visible). Works really well so that when the markers are de-clustered the labels show up.

I added a toggle to show/hide labels (they're always visible by default - either always visible or off).

When I do

geojson.eachLayer(function(layer) {
    layer.unbindLabel();
});

...
few seconds later
...
geojson.eachLayer(function(layer) {
    layer.bindLabel(layer.feature.properties.labelName, {noHide: true, clickable: true});
});

The labels don't show up until I zoom out and back in (until the markers are redrawn). Any help fixing this is appreciated! Is there an update method maybe?

@khuevu
Copy link

khuevu commented Oct 9, 2015

For my use case, I need to use updateLabelContent instead of unbind and bind label again.
For your use case, you might try to set the css of label to hide and unhide it instead.

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

No branches or pull requests

2 participants