I add a class to my geoJSON path with leaflet.
poly = new L.GeoJSON(polyArea[0], { style:{ weight:2, opacity:1, fillOpacity:0.5, className:"poly", } }).addTo(map)
The poly
class is correctly added to the path element besides the default leaflet-interactive
class.
<path class="poly leaflet-interactive" stroke="grey" stroke-opacity="1" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="grey" fill-opacity="0.5" fill-rule="evenodd" d="M332 ...(the whole path) 332z"></path>
However, when I want to add a style to the poly
class, let's say transition: all 500ms ease-in-out
to make it smoothly transition. It doesn't work.
But when I added the same style to :global(.leaflet-interactive)
, it works. It solves my problem. But I'm curious, why adding the style directly to the class doesn't work?