Skip to content

Commit

Permalink
Only evaluate CrossFaded properties at integer zooms (#6430)
Browse files Browse the repository at this point in the history
* validate non-integer stops for crossfaded properties

* add to style spec docs

* remove validation errors, only evalutate CrossFaded props at integer zooms

* reword spec
  • Loading branch information
mollymerp authored Apr 13, 2018
1 parent 6997943 commit 9090d10
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -2860,7 +2860,7 @@
"function": "piecewise-constant",
"zoom-function": true,
"transition": true,
"doc": "Name of image in sprite to use for drawing image fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).",
"doc": "Name of image in sprite to use for drawing image fills. 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.",
"sdk-support": {
"basic functionality": {
"js": "0.10.0",
Expand Down Expand Up @@ -2975,7 +2975,7 @@
"function": "piecewise-constant",
"zoom-function": true,
"transition": true,
"doc": "Name of image in sprite to use for drawing images on extruded fills. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512).",
"doc": "Name of image in sprite to use for drawing images on extruded fills. 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.",
"sdk-support": {
"basic functionality": {
"js": "0.27.0",
Expand Down Expand Up @@ -3245,7 +3245,7 @@
"value": "number",
"function": "piecewise-constant",
"zoom-function": true,
"doc": "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.",
"doc": "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.",
"minimum": 0,
"transition": true,
"units": "line widths",
Expand All @@ -3269,7 +3269,7 @@
"function": "piecewise-constant",
"zoom-function": true,
"transition": true,
"doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512).",
"doc": "Name of image in sprite to use for drawing image lines. For seamless patterns, image width must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.",
"sdk-support": {
"basic functionality": {
"js": "0.10.0",
Expand Down Expand Up @@ -4313,7 +4313,7 @@
"function": "piecewise-constant",
"zoom-function": true,
"transition": true,
"doc": "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).",
"doc": "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.",
"sdk-support": {
"basic functionality": {
"js": "0.10.0",
Expand Down
6 changes: 3 additions & 3 deletions src/style/properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,9 @@ export class CrossFadedProperty<T> implements Property<T, ?CrossFaded<T>> {
} else {
assert(!value.isDataDriven());
return this._calculate(
value.expression.evaluate({zoom: parameters.zoom - 1.0}),
value.expression.evaluate({zoom: parameters.zoom}),
value.expression.evaluate({zoom: parameters.zoom + 1.0}),
value.expression.evaluate({zoom: Math.floor(parameters.zoom - 1.0)}),
value.expression.evaluate({zoom: Math.floor(parameters.zoom)}),
value.expression.evaluate({zoom: Math.floor(parameters.zoom + 1.0)}),
parameters);
}
}
Expand Down

0 comments on commit 9090d10

Please sign in to comment.