Skip to the content

Kumimoji組み文字

Build crosswords from seeded English or Japanese tile bags, alone or at a shared table.

Kumimoji means assembled characters in Japanese. About the name

Contents

Reference · Rules, tiles and records

keepInReachfunction

Kept within reach: some of the area always on the screen, so a pan can never lose the crossword. A quarter of the screen or two tiles, whichever is less, stays in view on every side.

Import it

import { keepInReach } from "@johnmorrisdotca/kumimoji";

Definition

function keepInReach(view: View, area: Area, width: number, height: number): View

Parameters

NameTypeDescription
viewView

The current tile size and pixel translation.

areaArea

The occupied table bounds.

widthnumber

The available viewport width in pixels.

heightnumber

The available viewport height in pixels.

Returns

View

Kept within reach: some of the area always on the screen, so a pan can never lose the crossword. A quarter of the screen or two tiles, whichever is less, stays in view on every side.

Examples

import { keepInReach } from "@johnmorrisdotca/kumimoji";

const area = {top:0,left:0,rows:1,cols:3};
const view = {tile:40,x:100,y:100};
console.log(keepInReach(view,area,640,480));
{ tile: 40, x: 100, y: 100 }

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/kumimoji 1.6.0.