Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't restrict functions for piecewise-constant properties to integer zoom levels #4196

Merged
merged 1 commit into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions js/style-spec/validate/validate_function.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,21 +129,13 @@ module.exports = function validateFunction(options) {
}));
}

errors = errors.concat(validate({
return errors.concat(validate({
key: `${key}[1]`,
value: value[1],
valueSpec: functionValueSpec,
style: options.style,
styleSpec: options.styleSpec
}));

if (getType(value[0]) === 'number') {
if (functionValueSpec.function === 'piecewise-constant' && value[0] % 1 !== 0) {
errors.push(new ValidationError(`${key}[0]`, value[0], 'zoom level for piecewise-constant functions must be an integer'));
}
}

return errors;
}

function validateStopDomainValue(options) {
Expand Down
10 changes: 3 additions & 7 deletions test/js/style-spec/fixture/functions.output.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@
"message": "layers[9].paint.fill-translate[1]: number expected, object found",
"line": 152
},
{
"message": "layers[11].paint.fill-antialias.stops[0][0]: zoom level for piecewise-constant functions must be an integer",
"line": 204
},
{
"message": "layers[12].paint.fill-color.stops[1]: object expected, number found",
"line": 227
Expand Down Expand Up @@ -79,13 +75,13 @@
"message": "layers[18].paint.fill-color.stops[0][0]: number expected, string found\nIf you intended to use a categorical function, specify `\"type\": \"categorical\"`.",
"line": 341
},
{
"message": "layers[31].paint.fill-color.stops[0][0]: stop domain value must be a number, string, or boolean"
},
{
"message": "layers[19].paint.fill-color: \"property\" property is required",
"line": 354
},
{
"message": "layers[31].paint.fill-color.stops[0][0]: stop domain value must be a number, string, or boolean"
},
{
"message": "layers[22].paint.background-color.stops: identity function may not have a \"stops\" property",
"line": 402
Expand Down