MapPiece型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
How one region is drawn: usually in one piece, where it is.
A region in a box of its own is that one piece moved into the box. A region with outlying islands in a box - a prefecture whose far islands belong down their own chain rather than in the sea off the mainland - is two: the region where it is, and the islands in their frame. Both carry the same region, so whichever piece is clicked is the same place.
インポート
import type { MapPiece } from "@johnmorrisdotca/chizu";
定義
type MapPiece = {
d: string;
transform: InsetTransform | null;
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
d | string | |
transform | InsetTransform | null |
例
import { loadDivisions } from "@johnmorrisdotca/chizu/load";
import { insetFor, mapRegionPieces, type MapPiece } from "@johnmorrisdotca/chizu";
const japan = (await loadDivisions("jp"))!;
const tokyo = japan.regions.find((region) => region.code === "13")!;
const pieces: MapPiece[] = mapRegionPieces(tokyo, insetFor(japan, "13"));
console.log(pieces.map((piece) => (piece.transform ? "in its box" : "in place")).join(", "));
// in place, in its boxin place, in its box出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。