Nice work @Sahil   One problem though. Adding a viewBox to your <svg> element will throw all your calculations off. You actually don't need to calculate anything. You just need to get the local coordinates, much like @Dipscom was showing with offsetX/offsetY. But that doesn't work with SVG, so you have to do it manually. It's not hard to do, but remembering the syntax is.   Start out by creating a point using the createSVGPoint() method on any <svg> element.
    • Like