svg-grid-draggable
Make an svg element draggable inside the confines of a fixed grid.
Usage
Using this library to move svg-midi-notes inside a svg-midi-grid:
const html = const morph = const Note = const Grid = const Draggable = const note = const draggable = const grid = const cellHeight = 10const cellWidth = 20 const state = x: 80 y: 100 const onstart = consoleconst onmove = consoleconst onend = { statex = x statey = y console } const render = html` ` const update = { } const el = documentbody
Installation
$ npm install svg-grid-draggable
API
Draggable()
draggable.render({ x, y, cellWidth, cellHeight, onstart, onmove, onend, el })
License
MIT