Closed a1an77 closed 8 years ago
Is there no interest at all in such a feature? Any pointer at how to implement it eventually?
You can just
map.on('zoomend', function(){
if ( /* calculate if the zoom level change implies a label style change */ ) {
/* change label style */
}
});
Thanks @IvanSanchez that is indeed an option but it cuts off css, which would be cleaner (even though it might require defining up to 20 subclasses or so. I'll try your workaround meanwhile.
that is indeed an option but it cuts off css, which would be cleaner
map.on('zoomstart', function(){
L.DomUtil.removeClass(map.getContainer(), 'zoom-' + map.getZoom());
});
map.on('zoomend', function(){
L.DomUtil.addClass(map.getContainer(), 'zoom-' + map.getZoom());
});
You were saying? :-)
(Just beware of fractional zoom level support in Leaflet 1)
Is there a function for changing className
? Like there is setContent
for example, but setClassName
doesn't work
marker.label.options.className = 'test';
does the trick
Works like a charm @IvanSanchez thanks
Is there a possibility to have a different class assigned to the labels depending on the map zoom level? It would be useful for having different font sizes or colour at different zoom levels.
the zoom level could be added alongside the specified class name, such as zoom-level-NN