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 · Interactive maps

mountChizufunction

Puts a map in an element, to look at by touch, mouse and keyboard: drag to move it, the buttons, the wheel or a pinch to zoom in ten steps, a press to choose a region, the arrow keys and plus and minus. The world wraps: it pans east and west without stopping. Every part of it is the package's own drawing (drawChizu) in the page's own DOM, with no shadow DOM and nothing the page's style cannot reach.

Import it

import { mountChizu } from "@johnmorrisdotca/chizu/mount";

Definition

function mountChizu(host: HTMLElement, initial: ChizuMountOptions): ChizuMount

Parameters

NameTypeDescription
hostHTMLElement

The page or shadow-root element that receives the native map and its scoped styles.

initialChizuMountOptions

The initial native map, framing, display settings and interaction callbacks.

Returns

ChizuMount

The mounted native map handle; call destroy when removing its host.

Examples

import WORLD from "@johnmorrisdotca/chizu/world";
import { mountChizu } from "@johnmorrisdotca/chizu/mount";

const mount = mountChizu(document.querySelector<HTMLElement>("#map")!, {
  map: WORLD,
  onSelect: (code) => console.log("chosen", code),
});
mount.show(["JP", "KR"]);

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