Optional
componentOptional
selectOptional
viewImport shapes from JSON.
Optional
idInterceptor: ((id) => string)function to change the imported id to avoid name conflicts, eg. in case user decides to import multiple times or import after drawing
{
"components": [{
"id": "circle_1",
"type": "circle",
"data": {
"x": 444,
"y": 71,
"width": 241,
"height": 211
}
}]
}
{
"components": [{
"id": "rect_1",
"type": "rect",
"data": {
"x": 444,
"y": 71,
"width": 241,
"height": 211
}
}]
}
{
"components": [{
"id": "ellipse_1",
"type": "ellipse",
"data": {
"x": 444,
"y": 71,
"width": 241,
"height": 211
}
}]
}
{
"components": [{
"id": "polygon_1",
"type": "polygon",
"data": [{
"x": 603,
"y": 114
}, {
"x": 625,
"y": 203
}, {
"x": 699,
"y": 124
}]
}]
}
Completely or partly set current style of components, handles, hovering etc.
editor.setStyle({
component: {
fill: 'rgb(102, 102, 102)',
stroke: 'rgb(51, 51, 51)',
},
componentHover: {
off: {
'stroke-width': 1,
opacity: 0.5,
},
on: {
'stroke-width': 2,
opacity: 0.6,
},
},
componentSelect: {
off: {
'stroke-dasharray': 'none',
'stroke-linejoin': 'miter',
},
on: {
'stroke-dasharray': '4 3',
'stroke-linejoin': 'round',
},
},
handle: {
fill: 'rgb(255, 255, 255)',
stroke: 'rgb(51, 51, 51)',
'stroke-width': 1,
opacity: 0.3,
},
handleHover: {
opacity: 0.6,
},
});
Generated using TypeDoc
An Editor or View containing everything needed by the drawing/display board: DOM, event listeners, state and API functions.
Param: svgEl
the id of the SVG element to be created or the SVG element itself if it's already made
Param: options
Param: style
see Editor#setStyle