aboutsummaryrefslogtreecommitdiffstats
path: root/src/Mapbox
diff options
context:
space:
mode:
Diffstat (limited to 'src/Mapbox')
-rw-r--r--src/Mapbox/Element.elm18
-rw-r--r--src/Mapbox/Layer.elm28
2 files changed, 39 insertions, 7 deletions
diff --git a/src/Mapbox/Element.elm b/src/Mapbox/Element.elm
index 7802983..5a93501 100644
--- a/src/Mapbox/Element.elm
+++ b/src/Mapbox/Element.elm
@@ -1,6 +1,6 @@
module Mapbox.Element exposing
( map, css, MapboxAttr
- , token, id, maxZoom, minZoom, maxBounds, renderWorldCopies, featureState
+ , token, id, zoom_, center_, maxZoom, minZoom, maxBounds, renderWorldCopies, featureState
, EventData, TouchEvent, eventFeaturesFilter, eventFeaturesLayers
, onMouseDown, onMouseUp, onMouseOver, onMouseMove, onClick, onDblClick, onMouseOut, onContextMenu, onZoom, onZoomStart, onZoomEnd, onRotate, onRotateStart, onRotateEnd, onTouchEnd, onTouchMove, onTouchCancel, on
)
@@ -12,7 +12,7 @@ module Mapbox.Element exposing
### Attributes
-@docs token, id, maxZoom, minZoom, maxBounds, renderWorldCopies, featureState
+@docs token, id, zoom_, center_, maxZoom, minZoom, maxBounds, renderWorldCopies, featureState
### Events
@@ -75,6 +75,20 @@ css =
node "link" [ attribute "href" "https://api.tiles.mapbox.com/mapbox-gl-js/v0.53.0/mapbox-gl.css", attribute "rel" "stylesheet" ] []
+{-| Define the default zoom level of the map (0-24).
+-}
+zoom_ : Float -> MapboxAttr msg
+zoom_ =
+ Encode.float >> property "zoom" >> MapboxAttr
+
+
+{-| The default center pos.
+-}
+center_ : LngLat -> MapboxAttr msg
+center_ =
+ LngLat.encodeAsPair >> property "center" >> MapboxAttr
+
+
{-| The minimum zoom level of the map (0-24).
-}
minZoom : Float -> MapboxAttr msg
diff --git a/src/Mapbox/Layer.elm b/src/Mapbox/Layer.elm
index 1249b0a..24f457d 100644
--- a/src/Mapbox/Layer.elm
+++ b/src/Mapbox/Layer.elm
@@ -5,7 +5,7 @@ module Mapbox.Layer exposing
, LayerAttr
, 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
+ , lineBlur, lineCap, lineColor, lineDasharray, lineDasharray2, lineGapWidth, lineGradient, lineJoin, lineMiterLimit, lineOffset, lineOpacity, linePattern, lineRoundLimit, lineTranslate, lineTranslateAnchor, lineWidth
, circleBlur, circleColor, circleOpacity, circlePitchAlignment, circlePitchScale, circleRadius, circleStrokeColor, circleStrokeOpacity, circleStrokeWidth, circleTranslate, circleTranslateAnchor
, heatmapColor, heatmapIntensity, heatmapOpacity, heatmapRadius, heatmapWeight
, fillExtrusionBase, fillExtrusionColor, fillExtrusionHeight, fillExtrusionOpacity, fillExtrusionPattern, fillExtrusionTranslate, fillExtrusionTranslateAnchor, fillExtrusionVerticalGradient
@@ -64,7 +64,7 @@ Paint properties are applied later in the rendering process. Changes to a paint
### Line Attributes
-@docs lineBlur, lineCap, lineColor, lineDasharray, lineGapWidth, lineGradient, lineJoin, lineMiterLimit, lineOffset, lineOpacity, linePattern, lineRoundLimit, lineTranslate, lineTranslateAnchor, lineWidth
+@docs lineBlur, lineCap, lineColor, lineDasharray, lineDasharray2, lineGapWidth, lineGradient, lineJoin, lineMiterLimit, lineOffset, lineOpacity, linePattern, lineRoundLimit, lineTranslate, lineTranslateAnchor, lineWidth
### Circle Attributes
@@ -349,9 +349,16 @@ filter =
{-| Whether this layer is displayed.
-}
-visible : Expression CameraExpression Bool -> LayerAttr any
-visible vis =
- Layout "visibility" <| Expression.encode <| Expression.ifElse vis (Expression.str "visible") (Expression.str "none")
+visible : Bool -> LayerAttr any
+visible isVisible =
+ Layout "visibility" <|
+ Expression.encode <|
+ Expression.str <|
+ if isVisible then
+ "visible"
+
+ else
+ "none"
{-| Directly use a boolean value to set a layer to visible or not.
@@ -492,6 +499,17 @@ lineDasharray =
Expression.encode >> Paint "line-dasharray"
+{-| Specifies the lengths of the alternating dashes and gaps that form the dash pattern. The lengths are later scaled by the line width. To convert a dash length to pixels, multiply the length by the current line width. Note that GeoJSON sources with `lineMetrics: true` specified won't render dashed lines to the expected scale. Also note that zoom-dependent expressions will be evaluated only at integer zoom levels. Paint property.
+
+Should be greater than or equal to `0`.
+Units in line widths. Disabled by `linePattern`.
+
+-}
+lineDasharray2 : Expression any (Array Float) -> LayerAttr Line
+lineDasharray2 =
+ Expression.encode >> Paint "line-dasharray"
+
+
{-| Stroke thickness. Paint property.
Should be greater than or equal to `0`.