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

wrapAcrossfunction

A coordinate brought back onto the canvas, for a pan that has gone round.

Import it

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

Definition

function wrapAcross(x: number, width: number): number

Parameters

NameTypeDescription
xnumber

The horizontal native map coordinate.

widthnumber

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

Returns

number

A coordinate brought back onto the canvas, for a pan that has gone round.

Examples

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

console.log(wrapAcross(1030, 1000), wrapAcross(-20, 1000), wrapAcross(500, 1000));
// 30 980 500
30 980 500

What it prints (run when this page was built)

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