code: function getCursorRelativeToCanvas (e) {
              var cur = {};
  
              if (isTouchEvent(e)) {
                  cur.x = e.touches[0].pageX - canvas.offsetLeft;
                  cur.y = e.touches[0].pageY - canvas.offsetTop;
              } else {
                  var rect = that.canvas.getBoundingClientRect();
                  cur.x = e.clientX - rect.left;
                  cur.y = e.clientY - rect.top;
              }
  
              return getPointRelativeToCanvas(cur);
          }
docs: Get location of the cursor in the canvas