ChizuInset型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A region the map draws in a box of its own, instead of where its projection put it (Alaska, Hawaii, Okinawa).
インポート
import type { ChizuInset } from "@johnmorrisdotca/chizu";
定義
interface ChizuInset {
code: string;
box: MapBox;
outlyingBelow?: number;
within?: MapBox;
magnify?: boolean;
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
code | string | The region drawn in the box. |
box | MapBox | Where the box is on the map's canvas. |
outlyingBelow (省略可) | number | undefined | Only the region's outlying islands go in the box: the pieces that begin below this line on the canvas. The rest stays where it is. |
within (省略可) | MapBox | undefined | Only the pieces of the region that lie wholly inside this part of the canvas go in the box, where the projection put them. A region may have several boxes this way, each holding the islands of its own part of the sea: Okinawa is its main islands in one, the Sakishima Islands in another and the Daito Islands in a third, so each is drawn at a size it can be seen at. A piece no box takes stays where it is. |
magnify (省略可) | boolean | undefined | Whether the box may make what it holds bigger than life. Off, a region is only ever shrunk to fit. |
例
import { loadDivisions } from "@johnmorrisdotca/chizu/load";
import type { ChizuInset } from "@johnmorrisdotca/chizu";
const japan = (await loadDivisions("jp"))!;
// Kagoshima stays where it is; only its islands south of Yakushima go in the box.
const kagoshima: ChizuInset = japan.insets.find((inset) => inset.code === "46")!;
console.log(kagoshima.box, kagoshima.outlyingBelow !== undefined);
// { x: 300, y: 160, width: 110, height: 230 } true{ x: 300, y: 160, width: 110, height: 230 } true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。