-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcanvasData.js
More file actions
36 lines (35 loc) · 1.08 KB
/
canvasData.js
File metadata and controls
36 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const generate = (data) => {
const dotsOptions = data.dotsOptions || {}
const cornersSquareOptions = data.cornersSquareOptions || {}
const backgroundOptions = data.backgroundOptions || {}
const cornersDotOptions = data.cornersDotOptions || {}
const imageOptions = data.imageOptions || {}
return{
width: data.width || 300,
height: data.height || 300,
data: data.data,
image: data.image,
dotsOptions: {
color: dotsOptions.color || "#4267b2",
type: dotsOptions.type || 'square',
},
cornersSquareOptions: {
color: cornersSquareOptions.color || "#4267b2",
type: cornersSquareOptions.type || 'square',
},
cornersDotOptions: {
color: cornersDotOptions.color || "#4267b2",
type: cornersDotOptions.type || 'square',
},
backgroundOptions: {
color: backgroundOptions.color || "#ffffff",
},
imageOptions: {
hideBackgroundDots: imageOptions.hideBackgroundDots,
imageSize: imageOptions.imageSize,
crossOrigin: "anonymous",
margin: imageOptions.margin,
},
}
};
module.exports = generate;