Read-only property that retrieves the quadrille col under the current mouse position — computed against where this quadrille was last drawn.

  1. mouseCol is computed from the position and cellLength this quadrille was last drawn with — drawQuadrille captures them per call. Before any draw, origin defaults apply (0, 0, Quadrille.cellLength).
  2. It isn’t constrained to lie in [0..width] — guard with isValid.
  3. To query positions other than the last-drawn one, use screenCol instead.

Example#

code
Quadrille.cellLength = 50;
let quadrille;

function setup() {
  createCanvas(8 * Quadrille.cellLength, 8 * Quadrille.cellLength);
  quadrille = createQuadrille(4, 8);
}

function draw() {
  background('#6495ED');
  drawQuadrille(quadrille);
  text('mouseCol: ' + quadrille.mouseCol, 20, 20);
}

Syntax#

number = quadrille.mouseCol