Skip to content

textmode.js / input / mouse / MousePosition

Type Alias: MousePosition

ts
type MousePosition = object;

Mouse coordinates in grid space using center-based coordinates.

The coordinate system matches the main drawing/rendering space:

  • (0, 0) is the center cell of the grid
  • Negative X values are to the left of center
  • Positive X values are to the right of center
  • Negative Y values are above center
  • Positive Y values are below center

When the mouse is outside the grid bounds, both x and y are set to Number.NEGATIVE_INFINITY to indicate an invalid/outside position.

Properties

x

ts
x: number;

Horizontal grid coordinate.


y

ts
y: number;

Vertical grid coordinate.