diff options
author | André Dietrich <andre.dietrich@ovgu.de> | 2019-09-23 10:54:57 +0200 |
---|---|---|
committer | André Dietrich <andre.dietrich@ovgu.de> | 2019-09-23 10:54:57 +0200 |
commit | 9d091092b75fa90dda83868440ef04f43694e068 (patch) | |
tree | 83120c4b2000582d3962148cb6d391c430d35a47 /src | |
parent | e7947aef7cfa6c9cb447d4532245c534857487a2 (diff) |
added additional visibility function visible2 that directly uses a boolean
Diffstat (limited to 'src')
-rw-r--r-- | src/Mapbox/Layer.elm | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/Mapbox/Layer.elm b/src/Mapbox/Layer.elm index e441e86..1249b0a 100644 --- a/src/Mapbox/Layer.elm +++ b/src/Mapbox/Layer.elm @@ -3,7 +3,7 @@ module Mapbox.Layer exposing , background, fill, json, jsonList, symbol, line, raster, circle, fillExtrusion, heatmap, hillshade , Background, Fill, Symbol, Line, Raster, Circle, FillExtrusion, Heatmap, Hillshade , LayerAttr - , metadata, sourceLayer, minzoom, maxzoom, filter, visible + , metadata, sourceLayer, minzoom, maxzoom, filter, visible, visible2 , fillAntialias, fillColor, fillOpacity, fillOutlineColor, fillPattern, fillTranslate, fillTranslateAnchor , lineBlur, lineCap, lineColor, lineDasharray, lineGapWidth, lineGradient, lineJoin, lineMiterLimit, lineOffset, lineOpacity, linePattern, lineRoundLimit, lineTranslate, lineTranslateAnchor, lineWidth , circleBlur, circleColor, circleOpacity, circlePitchAlignment, circlePitchScale, circleRadius, circleStrokeColor, circleStrokeOpacity, circleStrokeWidth, circleTranslate, circleTranslateAnchor @@ -54,7 +54,7 @@ Paint properties are applied later in the rendering process. Changes to a paint ### General Attributes @docs LayerAttr -@docs metadata, sourceLayer, minzoom, maxzoom, filter, visible +@docs metadata, sourceLayer, minzoom, maxzoom, filter, visible, visible2 ### Fill Attributes @@ -354,6 +354,21 @@ visible vis = Layout "visibility" <| Expression.encode <| Expression.ifElse vis (Expression.str "visible") (Expression.str "none") +{-| Directly use a boolean value to set a layer to visible or not. +-} +visible2 : Bool -> LayerAttr any +visible2 vis = + (if vis then + "visible" + + else + "none" + ) + |> Expression.str + |> Expression.encode + |> Layout "visibility" + + -- Fill |