Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Leaflet: I can add class, but I can't add style to GeoJSON

$
0
0

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?


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>