Skip to content

Commit

Permalink
remove validation errors, only evalutate CrossFaded props at integer …
Browse files Browse the repository at this point in the history
…zooms
  • Loading branch information
Molly Lloyd committed Apr 10, 2018
1 parent 98bc617 commit 73ae041
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 44 deletions.
7 changes: 0 additions & 7 deletions src/style-spec/validate/validate_expression.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,5 @@ export default function validateExpression(options: any) {
return [new ValidationError(options.key, options.value, 'Invalid data expression for "text-font". Output values must be contained as literals within the expression.')];
}

if (options.expressionContext === 'property' && expression.value.kind === 'camera' && options.propertyKey.match(/(-pattern)|(-dasharray)/)) {
const nonIntStops = (expression.value: any).zoomStops.filter(z => Math.floor(z) !== z);
if (nonIntStops.length) {
return [new ValidationError(options.key, options.value, `Non-integer zoom steps are not supported for *-pattern or line-dasharray properties. Integer expected, found ${nonIntStops.join(', ')}`)];
}
}

return [];
}
4 changes: 0 additions & 4 deletions src/style-spec/validate/validate_function.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,10 +166,6 @@ export default function validateFunction(options) {
return [new ValidationError(options.key, reportValue, message)];
}

if (options.key.match(/(-pattern)|(-dasharray)/) && Math.floor(value) !== value) {
return [new ValidationError(options.key, reportValue, `Non-integer zoom steps are not supported for *-pattern or line-dasharray properties. Integer expected, found ${value}`)];
}

if (functionType === 'categorical' && type === 'number' && (!isFinite(value) || Math.floor(value) !== value)) {
return [new ValidationError(options.key, reportValue, `integer expected, found ${value}`)];
}
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
18 changes: 0 additions & 18 deletions test/unit/style-spec/fixture/properties.input.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,6 @@
"paint": {
"fill-opacity": "{opacity}"
}
},
{
"id": "line",
"type": "line",
"source": "vector",
"source-layer": "layer",
"paint": {
"line-pattern": ["step", ["zoom"], "hospital-11", 14.5, "dog-park-11"]
}
},
{
"id": "line2",
"type": "line",
"source": "vector",
"source-layer": "layer",
"paint": {
"line-dasharray": {"stops": [[12.5, [0, 1]], [14.5, [2, 1]]]}
}
}
]
}
12 changes: 0 additions & 12 deletions test/unit/style-spec/fixture/properties.output.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,5 @@
{
"message": "layers[4].paint.fill-opacity: \"fill-opacity\" does not support interpolation syntax\nUse an identity property function instead: `{ \"type\": \"identity\", \"property\": \"opacity\" }`.",
"line": 74
},
{
"message": "layers[5].paint.line-pattern: Non-integer zoom steps are not supported for *-pattern or line-dasharray properties. Integer expected, found 14.5",
"line": 83
},
{
"message": "layers[6].paint.line-dasharray.stops[0][0]: Non-integer zoom steps are not supported for *-pattern or line-dasharray properties. Integer expected, found 12.5",
"line": 92
},
{
"message": "layers[6].paint.line-dasharray.stops[1][0]: Non-integer zoom steps are not supported for *-pattern or line-dasharray properties. Integer expected, found 14.5",
"line": 92
}
]

0 comments on commit 73ae041

Please sign in to comment.