svg-sketch-controls

1.0.15 • Public • Published

svg-sketch-controls

controls used together with svg-sketch

js-standard-style

Try it out! view on requirebin

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

Readme

Keywords

Package Sidebar

Install

npm i svg-sketch-controls

Weekly Downloads

2

Version

1.0.15

License

MIT

Last publish

Collaborators

  • jameskyburz