Skip to content

Commit

Permalink
Canvas type (#656)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lauren Budorick authored Jan 20, 2017
1 parent 25d721b commit 30323e0
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 4 deletions.
11 changes: 10 additions & 1 deletion lib/validate/validate_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,20 @@ module.exports = function validateSource(options) {
styleSpec: styleSpec
});

case 'canvas':
return validateObject({
key: key,
value: value,
valueSpec: styleSpec.source_canvas,
style: style,
styleSpec: styleSpec
});

default:
return validateEnum({
key: key + '.type',
value: value.type,
valueSpec: {values: ['vector', 'raster', 'geojson', 'video', 'image']},
valueSpec: {values: ['vector', 'raster', 'geojson', 'video', 'image', 'canvas']},
style: style,
styleSpec: styleSpec
});
Expand Down
37 changes: 36 additions & 1 deletion reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
"source_tile",
"source_geojson",
"source_video",
"source_image"
"source_image",
"source_canvas"
],
"source_tile": {
"type": {
Expand Down Expand Up @@ -262,6 +263,40 @@
}
}
},
"source_canvas": {
"type": {
"required": true,
"type": "enum",
"values": {
"canvas": {
"doc": "A canvas data source."
}
},
"doc": "The data type of the canvas source."
},
"coordinates": {
"required": true,
"doc": "Corners of canvas specified in longitude, latitude pairs.",
"type": "array",
"length": 4,
"value": {
"type": "array",
"length": 2,
"value": "number",
"doc": "A single longitude, latitude pair."
}
},
"animate": {
"type": "boolean",
"default": "true",
"doc": "Whether the canvas source is animated. If the canvas is static, `animate` should be set to `false` to improve performance."
},
"canvas": {
"type": "string",
"required": true,
"doc": "HTML ID of the canvas from which to read pixels."
}
},
"layer": {
"id": {
"type": "string",
Expand Down
Loading

0 comments on commit 30323e0

Please sign in to comment.