Draw polylines and polygon with JSYG framework
http://yannickbochatay.github.io/JSYG.PolylineDrawer/
npm install jsyg-polylinedrawer
import PolylineDrawer from "jsyg-polylinedrawer"
let pencil = new PolylineDrawer()
document.querySelector("svg").addEventListener("mousedown",function(e) {
if (pencil.inProgress) return;
let poly = document.createElementNS("http://www.w3.org/2000/svg","polyline");
//with JSYG framework : path = JSYG("<polyline>")
this.appendChild(poly);
pencil.draw(poly,e);
});