mapBoxFromLocal関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The window on a world or country map that a local map covers, the way back from the city: the smallest window that
holds the ground of the local window (all of the canvas unless box is given). null where the map cannot be read
back to longitude and latitude.
インポート
import { mapBoxFromLocal } from "@johnmorrisdotca/chizu";
定義
function mapBoxFromLocal(map: Pick<ChizuMap, "projection">, local: Pick<ChizuMap, "projection" | "width" | "height">, box?: MapBox): MapBox | null
引数
| 名前 | 型 | 説明 |
|---|---|---|
map | Pick<ChizuMap, "projection"> | The world or country map to hand over to. |
local | Pick<ChizuMap, "width" | "height" | "projection"> | The local map to hand back from. |
box (省略可) | MapBox | undefined | A window on the local map; the whole canvas when left out. |
戻り値
MapBox | null
The window on the world or country map, or null where the local map or the map cannot be read back.
例
import WORLD from "@johnmorrisdotca/chizu/world";
import { localMap, mapBoxFromLocal } from "@johnmorrisdotca/chizu";
const city = localMap({ centre: [139.7671, 35.6812], widthMetres: 20_000 });
const window = mapBoxFromLocal(WORLD, city)!;
console.log(window.width < 5, window.x < 457.5 && 457.5 < window.x + window.width);
// true truetrue true出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。