getCursorPosition method

dynamic getCursorPosition(
  1. dynamic cursorX,
  2. dynamic cursorY,
  3. dynamic canvas
)

Calculate the cursor position inside the canvas x/y coordinates with the origin being in the center of the canvas @param {Number} x Cursor horizontal coordinate within the canvas @param {Number} y Cursor vertical coordinate within the canvas @param {HTMLElement} canvas The canvas where the renderer draws its output @returns {Vector2} Cursor position inside the canvas

Implementation

getCursorPosition(cursorX, cursorY, canvas) {
  _v2_1.copy(getCursorNDC(cursorX, cursorY, canvas));
  _v2_1.x *= (camera.right - camera.left) * 0.5;
  _v2_1.y *= (camera.top - camera.bottom) * 0.5;
  return _v2_1.clone();
}