diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Mapbox/Element.elm | 4 | ||||
-rw-r--r-- | src/Mapbox/Expression.elm | 25 | ||||
-rw-r--r-- | src/Mapbox/Layer.elm | 24 | ||||
-rw-r--r-- | src/Mapbox/Source.elm | 8 | ||||
-rw-r--r-- | src/js/main.js | 2 |
5 files changed, 51 insertions, 12 deletions
diff --git a/src/Mapbox/Element.elm b/src/Mapbox/Element.elm index a54d645..f067723 100644 --- a/src/Mapbox/Element.elm +++ b/src/Mapbox/Element.elm @@ -59,7 +59,7 @@ map attrs style = {-| This is literally: <link - href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.47.0/mapbox-gl.css' + href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.50.0/mapbox-gl.css' rel='stylesheet' /> You can include the required styles yourself if it fits better with the way you deploy your assets, this is meant as a quick way to get started. @@ -67,7 +67,7 @@ You can include the required styles yourself if it fits better with the way you -} css : Html msg css = - node "link" [ attribute "href" "https://api.tiles.mapbox.com/mapbox-gl-js/v0.48.0/mapbox-gl.css", attribute "rel" "stylesheet" ] [] + node "link" [ attribute "href" "https://api.tiles.mapbox.com/mapbox-gl-js/v0.50.0/mapbox-gl.css", attribute "rel" "stylesheet" ] [] {-| The minimum zoom level of the map (0-24). diff --git a/src/Mapbox/Expression.elm b/src/Mapbox/Expression.elm index 0411452..dd8087f 100644 --- a/src/Mapbox/Expression.elm +++ b/src/Mapbox/Expression.elm @@ -16,6 +16,7 @@ module Mapbox.Expression , Position , RasterResampling , SymbolPlacement + , SymbolZOrder , TextFit , TextJustify , TextTransform @@ -102,6 +103,8 @@ module Mapbox.Expression , notEqual , notEqualWithCollator , object + , orderSource + , orderViewportY , pi , plus , positionBottom @@ -290,7 +293,7 @@ Control flow: These are required for various layer properties. -@docs Anchor, anchorMap, anchorViewport, anchorAuto, Auto, Position, positionCenter, positionLeft, positionRight, positionTop, positionBottom, positionTopLeft, positionTopRight, positionBottomLeft, positionBottomRight, TextFit, textFitNone, textFitWidth, textFitHeight, textFitBoth, LineCap, lineCapButt, lineCapRound, lineCapSquare, LineJoin, lineJoinBevel, lineJoinRound, lineJoinMiter, SymbolPlacement, symbolPlacementPoint, symbolPlacementLine, symbolPlacementLineCenter, TextJustify, textJustifyLeft, textJustifyCenter, textJustifyRight, TextTransform, textTransformNone, textTransformUppercase, textTransformLowercase, RasterResampling, rasterResamplingLinear, rasterResamplingNearest +@docs Anchor, anchorMap, anchorViewport, anchorAuto, Auto, Position, positionCenter, positionLeft, positionRight, positionTop, positionBottom, positionTopLeft, positionTopRight, positionBottomLeft, positionBottomRight, TextFit, textFitNone, textFitWidth, textFitHeight, textFitBoth, LineCap, lineCapButt, lineCapRound, lineCapSquare, LineJoin, lineJoinBevel, lineJoinRound, lineJoinMiter, SymbolPlacement, symbolPlacementPoint, symbolPlacementLine, symbolPlacementLineCenter, TextJustify, textJustifyLeft, textJustifyCenter, textJustifyRight, TextTransform, textTransformNone, textTransformUppercase, textTransformLowercase, RasterResampling, rasterResamplingLinear, rasterResamplingNearest, SymbolZOrder, orderViewportY, orderSource -} @@ -671,6 +674,26 @@ rasterResamplingNearest = Expression (Json.Encode.string "nearest") +{-| Specifies the order in which overlapping symbols in the same layer are rendered +-} +type SymbolZOrder + = SymbolZOrder + + +{-| Symbols will be sorted by their y-position relative to the viewport. +-} +orderViewportY : Expression exprType SymbolZOrder +orderViewportY = + Expression (Json.Encode.string "viewport-y") + + +{-| Symbols will be rendered in the same order as the source data with no sorting applied. +-} +orderSource : Expression exprType SymbolZOrder +orderSource = + Expression (Json.Encode.string "source") + + -- literals diff --git a/src/Mapbox/Layer.elm b/src/Mapbox/Layer.elm index 79bbe1b..375a9d6 100644 --- a/src/Mapbox/Layer.elm +++ b/src/Mapbox/Layer.elm @@ -40,6 +40,7 @@ module Mapbox.Layer , fillExtrusionPattern , fillExtrusionTranslate , fillExtrusionTranslateAnchor + , fillExtrusionVerticalGradient , fillOpacity , fillOutlineColor , fillPattern @@ -113,6 +114,7 @@ module Mapbox.Layer , symbolAvoidEdges , symbolPlacement , symbolSpacing + , symbolZOrder , textAllowOverlap , textAnchor , textColor @@ -192,12 +194,12 @@ Paint properties are applied later in the rendering process. Changes to a paint ### FillExtrusion Attributes -@docs fillExtrusionBase, fillExtrusionColor, fillExtrusionHeight, fillExtrusionOpacity, fillExtrusionPattern, fillExtrusionTranslate, fillExtrusionTranslateAnchor +@docs fillExtrusionBase, fillExtrusionColor, fillExtrusionHeight, fillExtrusionOpacity, fillExtrusionPattern, fillExtrusionTranslate, fillExtrusionTranslateAnchor, fillExtrusionVerticalGradient ### Symbol Attributes -@docs iconAllowOverlap, iconAnchor, iconColor, iconHaloBlur, iconHaloColor, iconHaloWidth, iconIgnorePlacement, iconImage, iconKeepUpright, iconOffset, iconOpacity, iconOptional, iconPadding, iconPitchAlignment, iconRotate, iconRotationAlignment, iconSize, iconTextFit, iconTextFitPadding, iconTranslate, iconTranslateAnchor, symbolAvoidEdges, symbolPlacement, symbolSpacing, textAllowOverlap, textAnchor, textColor, textField, textFont, textHaloBlur, textHaloColor, textHaloWidth, textIgnorePlacement, textJustify, textKeepUpright, textLetterSpacing, textLineHeight, textMaxAngle, textMaxWidth, textOffset, textOpacity, textOptional, textPadding, textPitchAlignment, textRotate, textRotationAlignment, textSize, textTransform, textTranslate, textTranslateAnchor +@docs iconAllowOverlap, iconAnchor, iconColor, iconHaloBlur, iconHaloColor, iconHaloWidth, iconIgnorePlacement, iconImage, iconKeepUpright, iconOffset, iconOpacity, iconOptional, iconPadding, iconPitchAlignment, iconRotate, iconRotationAlignment, iconSize, iconTextFit, iconTextFitPadding, iconTranslate, iconTranslateAnchor, symbolAvoidEdges, symbolPlacement, symbolSpacing, symbolZOrder, textAllowOverlap, textAnchor, textColor, textField, textFont, textHaloBlur, textHaloColor, textHaloWidth, textIgnorePlacement, textJustify, textKeepUpright, textLetterSpacing, textLineHeight, textMaxAngle, textMaxWidth, textOffset, textOpacity, textOptional, textPadding, textPitchAlignment, textRotate, textRotationAlignment, textSize, textTransform, textTranslate, textTranslateAnchor ### Raster Attributes @@ -218,7 +220,7 @@ Paint properties are applied later in the rendering process. Changes to a paint import Array exposing (Array) import Json.Encode as Encode exposing (Value) -import Mapbox.Expression as Expression exposing (Anchor, Auto, CameraExpression, Color, DataExpression, Expression, FormattedText, LineCap, LineJoin, Position, RasterResampling, SymbolPlacement, TextFit, TextJustify, TextTransform) +import Mapbox.Expression as Expression exposing (Anchor, Auto, CameraExpression, Color, DataExpression, Expression, FormattedText, LineCap, LineJoin, Position, RasterResampling, SymbolPlacement, SymbolZOrder, TextFit, TextJustify, TextTransform) {-| Represents a layer. @@ -871,6 +873,13 @@ fillExtrusionOpacity = Expression.encode >> Paint "fill-extrusion-opacity" +{-| Whether to apply a vertical gradient to the sides of a fill-extrusion layer. If true, sides will be shaded slightly darker farther down. Paint property. Defaults to `true`. +-} +fillExtrusionVerticalGradient : Expression CameraExpression Bool -> LayerAttr FillExtrusion +fillExtrusionVerticalGradient = + Expression.encode >> Paint "fill-extrusion-vertical-gradient" + + -- Symbol @@ -897,6 +906,13 @@ textTranslateAnchor = Expression.encode >> Paint "text-translate-anchor" +{-| Controls the order in which overlapping symbols in the same layer are rendered Layout property. Defaults to `orderViewportY`. +-} +symbolZOrder : Expression CameraExpression SymbolZOrder -> LayerAttr Symbol +symbolZOrder = + Expression.encode >> Layout "symbol-z-order" + + {-| Distance between two symbol anchors. Layout property. Should be greater than or equal to `1`. @@ -1450,7 +1466,7 @@ hillshadeAccentColor = {-| Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels. Paint property. -} -backgroundPattern : Expression any String -> LayerAttr Background +backgroundPattern : Expression CameraExpression String -> LayerAttr Background backgroundPattern = Expression.encode >> Paint "background-pattern" diff --git a/src/Mapbox/Source.elm b/src/Mapbox/Source.elm index f472963..38bb319 100644 --- a/src/Mapbox/Source.elm +++ b/src/Mapbox/Source.elm @@ -17,7 +17,7 @@ module Mapbox.Source exposing (Coords, GeoJSONSource, Id, RasterSource, Scheme(. ### Raster -@docs raster, tileSize, rasterFromUrl, RasterSource, scheme, Scheme +@docs raster, tileSize, rasterFromUrl, RasterSource ### Raster DEM @@ -39,7 +39,7 @@ module Mapbox.Source exposing (Coords, GeoJSONSource, Id, RasterSource, Scheme(. Tiled sources can also take the following attributes: -@docs bounds, minzoom, maxzoom, attribution +@docs bounds, minzoom, maxzoom, attribution, scheme, Scheme ### Working with sources @@ -120,7 +120,7 @@ getId (Source k _) = -} bounds : LngLat -> LngLat -> SourceOption any bounds sw ne = - SourceOption "bounds" (Json.Encode.list Json.Encode.float [ sw.lng, sw.lat, sw.lng, sw.lat ]) + SourceOption "bounds" (Json.Encode.list Json.Encode.float [ sw.lng, sw.lat, ne.lng, ne.lat ]) {-| Minimum zoom level for which tiles are available, as in the TileJSON spec. @@ -210,7 +210,7 @@ generateIds = {-| Influences the y direction of the tile coordinates. The global-mercator (aka Spherical Mercator) profile is assumed. -} -scheme : Scheme -> SourceOption RasterSource +scheme : Scheme -> SourceOption any scheme s = case s of XYZ -> diff --git a/src/js/main.js b/src/js/main.js index e56533c..fb7d44f 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -362,7 +362,7 @@ export function registerPorts(elmApp, settings = {}) { } }); } else { - throw new Error(`Expected Elm App to expose ${elmApp.ports[options.outgoingPort]} port.`); + throw new Error(`Expected Elm App to expose ${options.outgoingPort} port. Please add https://github.com/gampleman/elm-mapbox/blob/master/examples/MapCommands.elm to your project and import it from your Main file.`); } return elmApp; |