Skip to the content

Chizu地図

Draw SVG maps, frame regions, place numbered callouts and build geography quizzes with English and Japanese names.

Chizu is the Japanese word 地図 for map. About the name

Contents

Reference · Framing, geometry and quiz tools

wrapIntoBoxfunction

The copy of a point that this window shows, or null when it shows none. What a number and its leader are placed against: a country the window does not hold gets neither, and on a wrapped map "does the window hold it" is a question about every copy, not only the one the projection drew.

Import it

import { wrapIntoBox } from "@johnmorrisdotca/chizu";

Definition

function wrapIntoBox(x: number, box: MapBox, width: number): number | null

Parameters

NameTypeDescription
xnumber

The horizontal native map coordinate.

boxMapBox

The window in native map units, or the inset destination specified by this signature.

widthnumber

The native canvas width or frame width specified by this signature.

Returns

number | null

The point’s horizontally wrapped coordinate in the window, or null when no copy lies in it.

Examples

import { wrapIntoBox } from "@johnmorrisdotca/chizu";

console.log(wrapIntoBox(950, { x: -100, y: 0, width: 400, height: 200 }, 1000));
// -50
-50

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chizu 1.5.0.