diff --git a/src/data/bucket/line_bucket.js b/src/data/bucket/line_bucket.js index a7b2ddd2e87..d73fcbeac75 100644 --- a/src/data/bucket/line_bucket.js +++ b/src/data/bucket/line_bucket.js @@ -96,7 +96,7 @@ class LineBucket extends Bucket { addFeature(feature: VectorTileFeature) { const layout = this.layers[0].layout; - const join = layout['line-join']; + const join = this.layers[0].getLayoutValue('line-join', {zoom: this.zoom}, feature.properties); const cap = layout['line-cap']; const miterLimit = layout['line-miter-limit']; const roundLimit = layout['line-round-limit']; diff --git a/src/style-spec/reference/v8.json b/src/style-spec/reference/v8.json index 7041f3323d4..be1f9725773 100644 --- a/src/style-spec/reference/v8.json +++ b/src/style-spec/reference/v8.json @@ -562,6 +562,7 @@ "type": "enum", "function": "piecewise-constant", "zoom-function": true, + "property-function": true, "values": { "bevel": { "doc": "A join with a squared-off end which is drawn beyond the endpoint of the line at a distance of one-half of the line's width." @@ -582,7 +583,9 @@ "ios": "2.0.0", "macos": "0.1.0" }, - "data-driven styling": {} + "data-driven styling": { + "js": "0.39.0" + } } }, "line-miter-limit": { diff --git a/test/integration/render-tests/line-join/property-function-dasharray/expected.png b/test/integration/render-tests/line-join/property-function-dasharray/expected.png new file mode 100644 index 00000000000..fef23ec06f1 Binary files /dev/null and b/test/integration/render-tests/line-join/property-function-dasharray/expected.png differ diff --git a/test/integration/render-tests/line-join/property-function-dasharray/style.json b/test/integration/render-tests/line-join/property-function-dasharray/style.json new file mode 100644 index 00000000000..7d2804ce3c2 --- /dev/null +++ b/test/integration/render-tests/line-join/property-function-dasharray/style.json @@ -0,0 +1,144 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 128, + "height": 64 + } + }, + "zoom": 0, + "sources": { + "geojson": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "join": "miter" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -36, + 16 + ], + [ + -36, + 0 + ], + [ + -20, + -16 + ], + [ + -20, + 16 + ], + [ + -28, + 16 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "join": "round" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -8, + 16 + ], + [ + -8, + 0 + ], + [ + 8, + -16 + ], + [ + 8, + 16 + ], + [ + 0, + 16 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "join": "bevel" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 20, + 16 + ], + [ + 20, + 0 + ], + [ + 36, + -16 + ], + [ + 36, + 16 + ], + [ + 28, + 16 + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "line", + "type": "line", + "source": "geojson", + "layout": { + "line-join": { + "type": "categorical", + "property": "join", + "stops": [ + [ + "miter", + "miter" + ], + [ + "round", + "round" + ], + [ + "bevel", + "bevel" + ] + ] + } + }, + "paint": { + "line-width": 8, + "line-dasharray": [1, 1] + } + } + ] +} diff --git a/test/integration/render-tests/line-join/property-function/expected.png b/test/integration/render-tests/line-join/property-function/expected.png new file mode 100644 index 00000000000..b4be40940a8 Binary files /dev/null and b/test/integration/render-tests/line-join/property-function/expected.png differ diff --git a/test/integration/render-tests/line-join/property-function/style.json b/test/integration/render-tests/line-join/property-function/style.json new file mode 100644 index 00000000000..ceda727e423 --- /dev/null +++ b/test/integration/render-tests/line-join/property-function/style.json @@ -0,0 +1,143 @@ +{ + "version": 8, + "metadata": { + "test": { + "width": 128, + "height": 64 + } + }, + "zoom": 0, + "sources": { + "geojson": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "join": "miter" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -36, + 16 + ], + [ + -36, + 0 + ], + [ + -20, + -16 + ], + [ + -20, + 16 + ], + [ + -28, + 16 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "join": "round" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -8, + 16 + ], + [ + -8, + 0 + ], + [ + 8, + -16 + ], + [ + 8, + 16 + ], + [ + 0, + 16 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "join": "bevel" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 20, + 16 + ], + [ + 20, + 0 + ], + [ + 36, + -16 + ], + [ + 36, + 16 + ], + [ + 28, + 16 + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "line", + "type": "line", + "source": "geojson", + "layout": { + "line-join": { + "type": "categorical", + "property": "join", + "stops": [ + [ + "miter", + "miter" + ], + [ + "round", + "round" + ], + [ + "bevel", + "bevel" + ] + ] + } + }, + "paint": { + "line-width": 8 + } + } + ] +}