getCursorPosition method
dynamic
getCursorPosition(
- dynamic cursorX,
- dynamic cursorY,
- 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
- @param {Number} x Cursor horizontal coordinate within the canvas
Implementation
getCursorPosition(cursorX, cursorY, canvas) {
this._v2_1.copy(this.getCursorNDC(cursorX, cursorY, canvas));
this._v2_1.x *= (this.camera.right - this.camera.left) * 0.5;
this._v2_1.y *= (this.camera.top - this.camera.bottom) * 0.5;
return this._v2_1.clone();
}