Skip to the content

Tsunagi繋ぎ

Join each pair with a separate line and fill the board, through fixed levels or seeded puzzles.

Tsunagi means joining in Japanese. About the name

Contents

Reference

Playable board

import { … } from "@johnmorrisdotca/tsunagi/play";

24.7 kB minified and gzipped, with everything it imports (measured with esbuild)

Tsunagi, played in a page: mountTsunagi draws a level into any element and plays it by touch and mouse, with Undo, Restart, Check and Cheat, the zoom pad for big boards, and the words in English and Japanese. A separate entry (@johnmorrisdotca/tsunagi/play), so a server never loads any of it.

Exports

NameKindWhat it is
edgeNudgefunctionHow far to move a zoomed view in a frame, for a finger at (x, y) in a box: toward the edge it is near, or not at all.
ensureTsunagiPlayStylefunctionPut the style in the page once: in the document's head, or in the shadow root the host is in.
keptViewfunctionA view kept inside the board: never a gap between the board's edge and the box's.
mountTsunagifunctionDraw a level into host and play it.
TSUNAGI_EDGEconstantHow near an edge of the box a line's end must be dragged to move the view, and how far each frame moves it, in pixels.
TSUNAGI_EDGE_STEPconstantThe native pixel increment for nudging the view near an edge.
TSUNAGI_FITTEDconstantThe whole board, fitted.
TSUNAGI_MOST_ZOOMconstantHow far a board may be zoomed in, as a multiple of the whole board fitted to its box.
TSUNAGI_PLAY_STYLEconstantTHE STYLE a playable Tsunagi board wears (mountTsunagi, <tsunagi-board>): the drawing's own (TSUNAGI_STYLE) and the board's box, its buttons, its lines of words and its zoom pad.
TSUNAGI_ZOOM_FROMconstantThe smallest board a player is given the pad for.
TsunagiEventDetailtypeWhat a mounted board tells of itself in every event.
TsunagiLooktypeWhat a board looks like: every option drawTsunagi takes that does not depend on the lines.
TsunagiMounttypeThe mounted native board handle and its game, display, action and cleanup methods.
TsunagiMountOptionstypeThe puzzle, native display choices, controls and event callbacks for mounting a board.
TsunagiViewtypeA BIG BOARD LOOKED AT THROUGH A BOX: from 10×10 up, a phone's cells are smaller than a thumb, so the board is drawn up to three times the box's width and looked at through it, zoomed and moved by a pad of buttons, the wheel and (while a line is dragged) the box's edge, never by scrolling the page.
zoomedAboutfunctionA view zoomed by factor about the point (px, py) of the box, which stays over the same spot of the board.

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/tsunagi 1.7.0.