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

HandleBoundstype

A box the handles should stay inside, so none is cropped at the frame edge.

Import it

import type { HandleBounds } from "@johnmorrisdotca/chizu";

Definition

type HandleBounds = {
    x: number;
    y: number;
    width: number;
    height: number;
};

Members

NameTypeDescription
xnumber
ynumber
widthnumber
heightnumber

Examples

import { placeHandles, type HandleBounds } from "@johnmorrisdotca/chizu";

const bounds: HandleBounds = { x: 0, y: 0, width: 100, height: 100 };
const spots = placeHandles([{ item: "a", centroid: [50, 50] }, { item: "b", centroid: [55, 50] }], 5, bounds);
console.log(spots.every((spot) => spot.hx >= 0 && spot.hx <= 100 && spot.hy >= 0 && spot.hy <= 100));
// true
true

What it prints (run when this page was built)

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