Reference · Rules, tiles and records
squareUnderfunction
The square under a point on the screen.
Import it
import { squareUnder } from "@johnmorrisdotca/kumimoji";
Definition
function squareUnder(view: View, px: number, py: number): { row: number; col: number; }
Parameters
| Name | Type | Description |
|---|---|---|
view | View | The current tile size and pixel translation. |
px | number | The horizontal pointer position in pixels. |
py | number | The vertical pointer position in pixels. |
Returns
{ row: number; col: number; }
The square under a point on the screen.
Examples
import { squareUnder } from "@johnmorrisdotca/kumimoji";
const view = {tile:40,x:100,y:100};
console.log(squareUnder(view,100,100));{ row: 0, col: 0 }What it prints (run when this page was built)