本文へ移動

Chizu地図

SVGの地図を描き、地域を表示範囲に収め、番号付きの注記や地理クイズを英語と日本語の名前で作れます。

「地図」は、土地や場所を図で表したものです。 名前について(英語)

目次

リファレンス · 表示範囲・形・クイズの道具

HANDLE_SLOTS定数

リファレンスの説明と例は英語です。見出しと目次は日本語です。

Positions a handle will try, in order, measured in radii from the centroid.

Straight above is the ordinary answer and straight below was the whole of the fallback, which is one position more than none: it was added for two small provinces whose handles landed in the same few pixels, and it fixed exactly that pair. A third crowded region found both taken and went back on top of the first.

Every vertical slot is tried before any sideways one, which is not about looks. The handles are numbered west to east so they read as a row, and a handle shoved sideways can cross the one it was supposed to follow - moving it up or down instead keeps the numbers in the order the player reads them. Sideways is still there for the cluster that runs out of column.

インポート

import { HANDLE_SLOTS } from "@johnmorrisdotca/chizu";

定義

const HANDLE_SLOTS: readonly (readonly [number, number])[] = [
    [0, -2.1],
    [0, 2.1],
    [0, -4.4],
    [0, 4.4],
    [0, -6.7],
    [0, 6.7],
    [-1.9, -1.5],
    [1.9, -1.5],
    [-1.9, 1.5],
    [1.9, 1.5],
    [-2.6, 0],
    [2.6, 0],
]

例

import { HANDLE_SLOTS } from "@johnmorrisdotca/chizu";

// Where a number may sit, in radii from its region's centre, nearest first.
console.log(HANDLE_SLOTS.length, HANDLE_SLOTS[0]);
// 12 [ 0, -2.1 ]
12 [ 0, -2.1 ]

出力(このページを作ったときに実行した結果)

ソースを見るGitHub で編集@johnmorrisdotca/chizu 1.5.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。