Leaflet.label
Leaflet.label copied to clipboard
showLabel() does not work with a Circle
similar to comment on polygon, label works but showlabel throws error.
I understand the issue with polygons (where to center), but in this case a Circle DOES have a center and a radius defined, so should be easier to include. Hopeful.
nice work anyhow
This is actually somewhat critical because the Circle constructor uses a radius in meters which is much nicer than circleMarker's radius in pixels.
We could do static labels for L.Circle
's. However the way Leaflet.label currently works you cannot have both the vector behavior (the label follows the mouse) and the marker behavior (the label shows at the center).
As a quick fix you can include the following code:
L.Circle.mergeOptions({
labelAnchor: new L.Point(0, 0)
});
L.Circle.include(L.BaseMarkerMethods);
This will make markers on circles show at the center and support the noHide
option. However when noHide = false
is used the label will only appear at the center (not useful for large circles).
Thanks, that helps a lot.