ChizuLocalMarkerInput型
リファレンスの説明と例は英語です。見出しと目次は日本語です。
A picture to put on a local map, given as the caller has it. See ChizuLocalMarker for what it becomes.
インポート
import type { ChizuLocalMarkerInput } from "@johnmorrisdotca/chizu";
定義
type ChizuLocalMarkerInput = {
name?: string;
nameJa?: string;
id?: string;
at: readonly [
number,
number
];
svg: string;
viewBox?: readonly [
number,
number,
number,
number
];
metresPerUnit?: number;
size?: readonly [
number,
number
];
bearing?: number;
anchor?: readonly [
number,
number
];
class?: string | readonly string[];
};
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
name (省略可) | string | undefined | A name for it: its |
nameJa (省略可) | string | undefined | |
id (省略可) | string | undefined | |
at | readonly [number, number] | Where its anchor goes: longitude and latitude, in degrees. |
svg | string | Its picture: a whole |
viewBox (省略可) | readonly [number, number, number, number] | undefined | The picture's own window, for bare markup (or to override the |
metresPerUnit (省略可) | number | undefined | How many metres a unit of the picture is. Default 1, so a picture drawn in metres is true to size. |
size (省略可) | readonly [number, number] | undefined | Or how big the picture's window is on the ground, |
bearing (省略可) | number | undefined | The direction the picture's top points, in degrees clockwise from true north. Default 0. |
anchor (省略可) | readonly [number, number] | undefined | The point of the picture, in its own units, that sits on |
class (省略可) | string | readonly string[] | undefined | Classes for your own style: letters, digits, |
例
import { localMap, type ChizuLocalMarkerInput } from "@johnmorrisdotca/chizu";
// A 100 m by 60 m pitch, drawn in metres, turned 30° east of north.
const pitch: ChizuLocalMarkerInput = {
at: [139.7006, 35.7004],
svg: '<svg viewBox="0 0 100 60"><rect width="100" height="60" fill="#9bd18a"/><line x1="50" y1="0" x2="50" y2="60" stroke="#fff"/></svg>',
bearing: 30,
name: "Pitch",
};
console.log(localMap({ centre: [139.7006, 35.7004], widthMetres: 300, markers: [pitch] }).markers.length);
// 11出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。