mountChizu関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { mountChizu } from "@johnmorrisdotca/chizu/mount";
定義
function mountChizu(host: HTMLElement, initial: ChizuMountOptions): ChizuMount
引数
| 名前 | 型 | 説明 |
|---|---|---|
host | HTMLElement | The page or shadow-root element that receives the native map and its scoped styles. |
initial | ChizuMountOptions | The initial native map, framing, display settings and interaction callbacks. |
戻り値
ChizuMount
The mounted native map handle; call destroy when removing its host.
例
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"]);この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。