diff --git a/build/generate-style-code.js b/build/generate-style-code.js index 2e816288071..42dc2d48045 100644 --- a/build/generate-style-code.js +++ b/build/generate-style-code.js @@ -33,7 +33,7 @@ global.flowType = function (property) { case 'formatted': return `Formatted`; case 'image': - return `Image`; + return `ResolvedImage`; case 'array': if (property.length) { return `[${new Array(property.length).fill(flowType({type: property.value})).join(', ')}]`; diff --git a/src/style/style_layer/background_style_layer_properties.js b/src/style/style_layer/background_style_layer_properties.js index 3d7e45e4ab9..868663cfce1 100644 --- a/src/style/style_layer/background_style_layer_properties.js +++ b/src/style/style_layer/background_style_layer_properties.js @@ -19,6 +19,7 @@ import type Formatted from '../../style-spec/expression/types/formatted'; import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "background-color": DataConstantProperty, "background-pattern": CrossFadedProperty, diff --git a/src/style/style_layer/circle_style_layer_properties.js b/src/style/style_layer/circle_style_layer_properties.js index e5574c4f005..5b8224423bb 100644 --- a/src/style/style_layer/circle_style_layer_properties.js +++ b/src/style/style_layer/circle_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type LayoutProps = {| "circle-sort-key": DataDrivenProperty, |}; diff --git a/src/style/style_layer/fill_extrusion_style_layer_properties.js b/src/style/style_layer/fill_extrusion_style_layer_properties.js index 6d13b8639a8..7118f906338 100644 --- a/src/style/style_layer/fill_extrusion_style_layer_properties.js +++ b/src/style/style_layer/fill_extrusion_style_layer_properties.js @@ -19,6 +19,7 @@ import type Formatted from '../../style-spec/expression/types/formatted'; import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "fill-extrusion-opacity": DataConstantProperty, "fill-extrusion-color": DataDrivenProperty, diff --git a/src/style/style_layer/heatmap_style_layer_properties.js b/src/style/style_layer/heatmap_style_layer_properties.js index 76b6079e550..53bdaf3baa3 100644 --- a/src/style/style_layer/heatmap_style_layer_properties.js +++ b/src/style/style_layer/heatmap_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "heatmap-radius": DataDrivenProperty, diff --git a/src/style/style_layer/hillshade_style_layer_properties.js b/src/style/style_layer/hillshade_style_layer_properties.js index 39d94286ad8..7a82d3e36a3 100644 --- a/src/style/style_layer/hillshade_style_layer_properties.js +++ b/src/style/style_layer/hillshade_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "hillshade-illumination-direction": DataConstantProperty, diff --git a/src/style/style_layer/layer_properties.js.ejs b/src/style/style_layer/layer_properties.js.ejs index 9fabb9505f5..497242d7c23 100644 --- a/src/style/style_layer/layer_properties.js.ejs +++ b/src/style/style_layer/layer_properties.js.ejs @@ -21,6 +21,8 @@ import { import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; + +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; <% const overridables = paintProperties.filter(p => p.overridable) if (overridables.length) { -%> diff --git a/src/style/style_layer/raster_style_layer_properties.js b/src/style/style_layer/raster_style_layer_properties.js index b813a73459c..15356168308 100644 --- a/src/style/style_layer/raster_style_layer_properties.js +++ b/src/style/style_layer/raster_style_layer_properties.js @@ -17,6 +17,8 @@ import type Color from '../../style-spec/util/color'; import type Formatted from '../../style-spec/expression/types/formatted'; +import type ResolvedImage from '../../style-spec/expression/types/resolved_image'; + export type PaintProps = {| "raster-opacity": DataConstantProperty, diff --git a/src/util/web_worker_transfer.js b/src/util/web_worker_transfer.js index 6e90b374e09..84a41469bfc 100644 --- a/src/util/web_worker_transfer.js +++ b/src/util/web_worker_transfer.js @@ -7,6 +7,7 @@ import Color from '../style-spec/util/color'; import {StylePropertyFunction, StyleExpression, ZoomDependentExpression, ZoomConstantExpression} from '../style-spec/expression'; import CompoundExpression from '../style-spec/expression/compound_expression'; import expressions from '../style-spec/expression/definitions'; +import ResolvedImage from '../style-spec/expression/types/resolved_image'; import window from './window'; const {ImageData} = window; @@ -86,6 +87,7 @@ register('Grid', Grid); register('Color', Color); register('Error', Error); +register('ResolvedImage', ResolvedImage); register('StylePropertyFunction', StylePropertyFunction); register('StyleExpression', StyleExpression, {omit: ['_evaluator']}); diff --git a/test/integration/render-tests/line-pattern/zoom-expression/expected.png b/test/integration/render-tests/line-pattern/zoom-expression/expected.png new file mode 100644 index 00000000000..38c3ab2ad09 Binary files /dev/null and b/test/integration/render-tests/line-pattern/zoom-expression/expected.png differ diff --git a/test/integration/render-tests/line-pattern/zoom-expression/style.json b/test/integration/render-tests/line-pattern/zoom-expression/style.json new file mode 100644 index 00000000000..bf6e5f3deac --- /dev/null +++ b/test/integration/render-tests/line-pattern/zoom-expression/style.json @@ -0,0 +1,101 @@ +{ + "version": 8, + "metadata": { + "test": { + "height": 128, + "width": 128 + } + }, + "zoom": 2, + "sprite": "local://sprites/emerald", + "sources": { + "a": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "class": "trunk" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + 10, + -10 + ], + [ + -10, + -10 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "class": "path" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -10, + 0 + ], + [ + 10, + 0 + ] + ] + } + }, + { + "type": "Feature", + "properties": { + "class": "street" + }, + "geometry": { + "type": "LineString", + "coordinates": [ + [ + -10, + 10 + ], + [ + 10, + 10 + ] + ] + } + } + ] + } + } + }, + "layers": [ + { + "id": "background", + "type": "background", + "paint": { + "background-color": "white" + } + }, + { + "id": "road", + "type": "line", + "source": "a", + "paint": { + "line-width": 10, + "line-pattern": [ + "step", ["zoom"], + "generic_icon", + 2, + "generic_metro" + ] + } + } + ] +}