'mapbox : how to combine two expressions to style a layer?
I have this expressions that styles my layer when a feature is clicked: the circle radius changes from 2 (default) to 5 (clicked).
'circle-radius'=> [
'case',
['boolean', ['feature-state', 'clicked'], false],
5,//clicked
2//default
]
But I also want that the radius changes when the feature is hovered:
'circle-radius'=> [
'case',
['boolean', ['feature-state', 'hovered'], false],
7,//hovered
2//default
]
How can I combine those two expressions into one ?
Thanks !
Solution 1:[1]
I found out:
'circle-radius'=>[
'case',
['boolean', ['feature-state', 'hovered'], false], 7,
['boolean', ['feature-state', 'clicked'], false], 5,
2 //else
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | gordie |