Skip to content

textmode.js / input / mouse / MousePosition

Interface: MousePosition

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.

Extends

  • GridPosition

Properties

PropertyTypeDescriptionInherited from
xnumberThe X coordinate (column), often relative to the grid's center.GridPosition.x
ynumberThe Y coordinate (row), often relative to the grid's center.GridPosition.y