0.0.4 • Published 2 years ago
@shapeshop/core v0.0.4
ShapeShop
api
The ShapeShop constructor accepts 3 arguments.
- required an HTMLElement, in the dom, you wish to capture mouse events on
- required the default
ShapeType
you want ShapeShop to interpret from these events - optional a callback you want to execute on each mouse event, which is passed a
CanvasUpdate
when invoked.
const shapeshop = new ShapeShop({
el: $el,
defaultShape: ShapeType.Rect,
onCanvasUpdate: (update) => {
console.log(update);
}
});
When you are done with shapeshop, call the destroy method to clean up its mouse event listeners
shapeshop.destroy();