ChizuMountOptions型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
What a mounted map is told. Everything but map may be changed later with set.
インポート
import type { ChizuMountOptions } from "@johnmorrisdotca/chizu/mount";
定義
type ChizuMountOptions = {
map: ChizuMap;
language?: ChizuLanguage;
zoom?: MapZoom;
tones?: Readonly<Record<string, string>>;
colors?: Readonly<Record<string, string>>;
callouts?: ChizuDrawOptions["callouts"];
labels?: ChizuDrawOptions["labels"];
selected?: string | null;
fit?: boolean;
selectable?: boolean;
controls?: boolean;
onSelect?: (code: string | null) => void;
detail?: ChizuMap | (() => Promise<ChizuMap>);
detailFrom?: MapZoom;
onView?: (view: ChizuView) => void;
features?: readonly ChizuFeatureChoice[];
featureLayer?: ChizuFeatureLayer | null | ((mapId: string) => Promise<ChizuFeatureLayer | null>);
featureLabels?: boolean;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
map | ChizuMap | The map to show: |
language (省略可) | ChizuLanguage | undefined | The language of the names and of the buttons. Default: the page's |
zoom (省略可) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | undefined | The zoom step to start at (1 to 10). Default 1. |
tones (省略可) | Readonly<Record<string, string>> | undefined | Tones by code ( |
colors (省略可) | Readonly<Record<string, string>> | undefined | A colour for each region by code ( |
callouts (省略可) | readonly string[] | Omit<CalloutRequest, "box"> | undefined | Numbered callouts ( |
labels (省略可) | boolean | readonly string[] | undefined | Print names on the land. |
selected (省略可) | string | null | undefined | The chosen region's code, or null. |
fit (省略可) | boolean | undefined | Zoom in on a region when it is chosen. Default true. |
selectable (省略可) | boolean | undefined | Whether pressing a region chooses it. Off, a press does nothing and the map is only looked at (a quiz that asks the question itself). Default true. |
controls (省略可) | boolean | undefined | Show the zoom buttons and the zoom level. Default true. |
onSelect (省略可) | ((code: string | null) => void) | undefined | A region was pressed (or its number): its code. Pressing the chosen one again passes null. |
detail (省略可) | ChizuMap | (() => Promise<ChizuMap>) | undefined | A finer drawing of the same map, drawn from |
detailFrom (省略可) | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | undefined | The zoom step the finer drawing starts at. Default 4. |
onView (省略可) | ((view: ChizuView) => void) | undefined | The view changed: after a zoom, and when a drag ends. |
features (省略可) | readonly ChizuFeatureChoice[] | undefined | Which named features to draw ( |
featureLayer (省略可) | ChizuFeatureLayer | ((mapId: string) => Promise<ChizuFeatureLayer | null>) | null | undefined | The map's named features: a layer ( |
featureLabels (省略可) | boolean | undefined | Print the features' names. Default true. |
例
import WORLD from "@johnmorrisdotca/chizu/world";
import { mountChizu, type ChizuMountOptions } from "@johnmorrisdotca/chizu/mount";
const options: ChizuMountOptions = { map: WORLD, language: "ja", selected: "JP", onSelect: (code) => console.log(code) };
mountChizu(document.querySelector<HTMLElement>("#map")!, options);この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。