arcade2d
Interface

MouseState

input/mouse.types.ts:77

Extends MouseSnapshot

Per-tick snapshot of mouse state at the world tier — the MouseSnapshot plus a position field giving the cursor's location in world space, with the active world's camera transform already inverted out. Returned by World.getMouseState.

  • MouseState.position reflects the camera's inverse transform. With the default camera, this matches MouseSnapshot.screenPosition shifted so the canvas centre maps to world (0, 0). Moving, rotating, or zooming the camera shifts the world position accordingly. Camera shake is excluded so a click during a shake still resolves to the logical world point.
  • Inherits the screen-space screenPosition and buttons fields from MouseSnapshot.

Properties

readonly #
buttons: MouseButtons

Held state of the three standard mouse buttons. See MouseButtons for the per-button semantics.

readonly #
position: Point

Cursor position in world space. See the interface-level docs for the exact camera-transform semantics.

readonly #
screenPosition: Point

Cursor position in canvas-local pixels. (0, 0) is the canvas's top-left, regardless of where the canvas sits on the page.

ESC