Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

Canvas type #656

Merged
merged 6 commits into from
Jan 20, 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
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