Draw svg shapes with JSYG framework
http://yannickbochatay.github.io/JSYG.ShapeDrawer
npm install jsyg-shapedrawer
import ShapeDrawer from "jsyg-shapedrawer"
let drawer = new JSYG.ShapeDrawer();
drawer.on("end",function(e,shape) {
alert("What a beautiful "+shape.tagName);
});
document.querySelector("svg").on("mousedown",function(e) {
let shape = document.createElementNS("http://www.w3.org/2000/svg","rect");
//with JSYG framework : shape = JSYG("<rect>")
this.appendChild(shape);
drawer.draw(shape,e);
});