shramov / leaflet-plugins

Plugins for Leaflet library
http://psha.org.ru/b/leaflet-plugins.html
MIT License
725 stars 288 forks source link

Unable to adjust layer opacity #240

Closed f00dl3 closed 8 years ago

f00dl3 commented 8 years ago

I am unable to adjust a KML layer opacity, using GIF images as the KML data source.

var radar = new L.KML("Maps/Overlay/RadarB.kml", {async: true, setOpacity: 0.5});

does not work, neither does opacity: 0.5});

I tried applying radar.opacity(0.5); or radar.setOpacity(0.5); after AND before radar.on("loaded"... as well. Any addition of that property completely hides the KML layer.

brunob commented 8 years ago

Please, provide a fiddle or a demo page showing the problem in order to allow us to help you...

f00dl3 commented 8 years ago

I tried. Not sure what I'm doing wrong but even without demonstrating the bug it's not working... {"error": "Please use POST request"} -- I have no forms in my script at all.

Either way ... https://jsfiddle.net/f00dl3/L51mcsh3/

I did fine I was able to make the KML layer transparent by setting 72 in the KML file it's self, but the performance really sucks doing that as it makes the animation skip frames on my Intel 4790k w/ 16 GB RAM and GeForce GTX 960.

brunob commented 8 years ago

Your fiddle doesn't include leaflet and the kml script, it would be hard to work in this state...

Anyway, there is no setOpacity or opacity option for the kml, you have to define opacity of your items in the styles directly in your kml document.