Reference · Rules, tiles and records
turnViewfunction
A view the player zoomed or panned, turned a quarter clockwise with the table about the middle of its box: the same zoom, and the spot of the table that was in the middle stays there. (A fitted view simply fits again.)
On the screen a square's corner is x + col * tile; the turn takes a point
(row v, col u) of the table to (row u, col 1 - v), which is a quarter turn
about the middle of square (0, 0) — the same turn as turnPlace.
Import it
import { turnView } from "@johnmorrisdotca/kumimoji";
Definition
function turnView(view: View, width: number, height: number): View
Parameters
| Name | Type | Description |
|---|---|---|
view | View | The current tile size and pixel translation. |
width | number | The available viewport width in pixels. |
height | number | The available viewport height in pixels. |
Returns
View
A view the player zoomed or panned, turned a quarter clockwise with the table about the middle of its box: the same zoom, and the spot of the table that was in the middle stays there. (A fitted view simply fits again.)
Examples
import { turnView } from "@johnmorrisdotca/kumimoji";
const view = {tile:40,x:100,y:100};
console.log(turnView(view,640,480));{ tile: 40, x: 420, y: 20 }What it prints (run when this page was built)