Reference · SVG faces and looks
tileAtfunction
Where a slot's tile face is drawn, raised by its layer along the thickness's direction. With a view that turns the board (mirror) the layout's width and height in half-tiles are needed too.
Import it
import { tileAt } from "@johnmorrisdotca/jarajara/faces";
Definition
function tileAt(slot: MahjongSlot, layers: number, mirror?: TileMirror, extent?: { width: number; height: number; }): { x: number; y: number; }
Parameters
| Name | Type | Description |
|---|---|---|
slot | MahjongSlot | The zero-based slot index or slot coordinates specified by this signature. |
layers | number | The total number of stacked layers. |
mirror (optional) | "none" | "horizontal" | "vertical" | "both" | The native mirrored tile orientation. |
extent (optional) | { width: number; height: number; } | undefined | The complete layout width and height. |
Returns
{ x: number; y: number; }
Where a slot's tile face is drawn, raised by its layer along the thickness's direction. With a view that turns the board (mirror) the layout's width and height in half-tiles are needed too.
Examples
import { layoutExtent, layoutFor } from "@johnmorrisdotca/jarajara";
import { tileAt } from "@johnmorrisdotca/jarajara/faces";
const layout = layoutFor(4)!;
console.log(tileAt(layout.slots[0],layoutExtent(layout).layers));{ x: 5, y: 15 }What it prints (run when this page was built)