code: function getCursorPosition(event) {
    let cursorX;
    let cursorY;
    let rect = htmlElement.getBoundingClientRect();
    if (event.touches !== undefined) {
      cursorX = event.touches[0].clientX;
      cursorY = event.touches[0].clientY;
    } else {
      cursorX = event.clientX;
      cursorY = event.clientY;
    }
    return {
      x: cursorX - rect.left,
      y: cursorY - rect.top,
    };
  }
docs: Get cursor position on canvas.
  @param {Object} event
  @return {Object}
  @private