anvilsign in

collin/mahjong

master / src / ui / rotation.ts
1import type { Edge } from '../table/physics';
2import type { SeatId } from '../game/types';
3
4/**
5 * Screen rotation that makes a seat's content face that player.
6 * Seat 0 sits at the bottom edge and play runs counter-clockwise on screen:
7 * 1 = right, 2 = top, 3 = left.
8 */
9export const SEAT_ROT: Record<SeatId, number> = { 0: 0, 1: -90, 2: 180, 3: 90 };
10
11/**
12 * Who is sitting at each edge of the table — the same fact read the other way
13 * round. The middle stops where a player's tiles start, so a tile that reaches
14 * an edge has been thrown at whoever this says.
15 */
16export const EDGE_SEAT: Record<Edge, SeatId> = { bottom: 0, right: 1, top: 2, left: 3 };
17
18export const SEAT_SLOT: Record<SeatId, string> = {
19 0: 'slot-bottom',
20 1: 'slot-right',
21 2: 'slot-top',
22 3: 'slot-left',
23};