MapML icon indicating copy to clipboard operation
MapML copied to clipboard

Set the opacity of a <layer> via CSS

Open prushforth opened this issue 5 years ago • 3 comments

It should be possible to manipulate the (overall) opacity of a layer via the CSS opacity property. It would be ideal to have that opacity reflected in the opacity control:

image

This is one aspect of setting the "style" of a map.

prushforth avatar Sep 09 '20 15:09 prushforth

Off-topic but related:

Would it also make sense to have an opacity attribute (similar to SVG opacity) applicable to <layer> for specifying the default opacity of a layer?

<layer opacity="0.5">

Malvoz avatar Sep 09 '20 20:09 Malvoz

I thought those SVG property specific attributes were unloved. I know I always am confused by them. Maybe @AmeliaBR has an opinion on this?

prushforth avatar Sep 09 '20 20:09 prushforth

In MapML, I believe an opacity attribute would be analogous to the HTML <meter> / <progress> element's value attribute. Or <map>'s lon, lat, zoom even.

An attribute can be used even when style sheets fail to load or are disabled by the user.

Maybe we should move this discussion, about the opacity attribute, to the MapML repo?

Malvoz avatar Sep 11 '20 10:09 Malvoz