svg-sketch-controls
controls used together with svg-sketch
Use with browserify
methods
optional methods implemented by each control
var control = Control(el);
el is the svg parent element
control.matchEvent(event)
does event match current control?
useful if UI is to show current control (pencil, rectangle etc)
control.down(xy)
Called with xy
control.up(xy)
Called with xy
control.pathSelected(opt)
opt.e dom event opt.path svg path in json eventstream
events
createEvent(event)
event contains
{
type: 'type',
args: {
'svg args + metadata'
},
origin: xy
}
updateEvent(event)
same structure as for createEvent
deleteEvent(event)
delete event
closeToPath(target)
close to svg path useful with touch devices
when touching the exact point on the svg path may be hard
install
With npm do:
npm install svg-sketch-controls
license
MIT