The freehand drawing tool is very laggy (also doesn't show my drawing until after I finish via mouseup or touchend events) and I'm not sure why. My simple-svg-designer app (https://michaelsboost.com/simple-svg-designer/) uses Fabric.js. It's easy smooth and simple to draw with that or even using Paper.js (https://codepen.io/bboyle/pen/OzbaPX?editors=0010)
Not sure what library or framework you use but the fact you use canvas and based upon my own experience this functionality isn't hard to implement but just something I thought I would point out and express
May want to look into the PathSeg polyfill as well for this implementation - https://github.com/progers/pathseg