-
Notifications
You must be signed in to change notification settings - Fork 130
Opacity property is not like the others #249
Comments
I agree that we should consider warning or throwing with "sorry opacity should only be set once per style" for the style you've provided because its not clear which wins. But they are not exactly layer options, so I think they make more sense where they are, despite potential ambiguity, than in the mml. #countries {
::outline {
line-color: #85c5d3;
line-width: 2;
line-join: round;
opacity:.5;
}
polygon-fill: #fff;
opacity:.1;
} Would produce: |
Thanks, I’ll keep this in mind when I use opacity in the future. |
@tmcw - do you think it is actionable to throw if one of these style level options is detected twice inside a single attachment? |
(also thanks for the attachments pointer—I’ve always found that feature of Carto confusing so I don’t use it and don’t reach for it when I should) |
Might be a little tricky, but seems possible. |
I'd prefer it to not throw, and to let you set the option twice. The cascading rules of CSS should be clear, that defining the same value for the second time simply overrides it. I think that keeping the cascade might be useful when making customisations to large third-party styles - perhaps you want to track an upstream style but override one or two settings in a separate mss file (making it easier to pull in updates). Throwing if opacity is defined twice would prohibit that approach, and it's not clear why we'd treat style-level rules differently from symbolizer-level rules in any case. |
I’d prefer it if style rules didn’t throw either, but we have here a style rule that’s not really a feature-based style rule at all. Does it belong in Carto in the first place? |
Signed-off-by: mge <[email protected]>
logging for later reflection: as per my comment at g12n/cardboardMap@a7d37bc#commitcomment-3823331, it looks like when two |
As pointed out by Dane Springmeyer ( springmeyer ) blur couldnt be reset by zoom-level. »image-filters actually operate at the style level (like the bar opacity parameter - see mapbox/carto#249) and are applied to the rendering canvas once all features are rendered. « Signed-off-by: mge <[email protected]>
Opacity
(and relatedcomp-op
) operates on a layer as a whole. However, it’s specified inline with the rest of the rules, which is confusing. This sort of thing shouldn’t work, or should perhaps throw a warning:My experience has been that opacity gets set just once, for the whole layer, and I’m not sure how to predict which one would win in this case.
These properties should probably be specified on layers in the
.mml
file instead.The text was updated successfully, but these errors were encountered: