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

edgeNudgefunction

How 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.

Import it

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

Definition

function edgeNudge(x: number, y: number, box: { left: number; top: number; right: number; bottom: number; }): { dx: number; dy: number; }

Parameters

NameTypeDescription
xnumber

The horizontal point, edge-code or coordinate value specified by this signature.

ynumber

The vertical point, edge-code or coordinate value specified by this signature.

box{ left: number; top: number; right: number; bottom: number; }

The available square view size or edge bounds.

Returns

{ dx: number; dy: number; }

How 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.

Examples

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

console.log(edgeNudge(5,100,{left:0,top:0,right:640,bottom:480}));
{ dx: 6, dy: 0 }

What it prints (run when this page was built)

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