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

boxCentrefunction

Where a box is looking, which is what a zoom step keeps hold of.

Import it

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

Definition

function boxCentre(box: MapBox): { x: number; y: number; }

Parameters

NameTypeDescription
boxMapBox

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

Returns

{ x: number; y: number; }

Where a box is looking, which is what a zoom step keeps hold of.

Examples

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

console.log(boxCentre({ x: 100, y: 50, width: 200, height: 100 }));
// { x: 200, y: 100 }
{ x: 200, y: 100 }

What it prints (run when this page was built)

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