本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · リアルな地球の計算部分

CityLayoutOptions型

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

What the names are laid out with: the most names, the text size in pixels and the dot's radius, and how squarely a city must face the viewer (0.12 by default).

インポート

import type { CityLayoutOptions } from "@johnmorrisdotca/chikyu-earth/realistic";

定義

interface CityLayoutOptions {
    max: number;
    size: number;
    dot: number;
    facing?: number;
    measure?: (text: string) => number;
    taken?: readonly {
        left: number;
        top: number;
        width: number;
        height: number;
    }[];
}

メンバー

名前型説明
maxnumber
sizenumber
dotnumber
facing (省略可)number | undefined

Cities that face the viewer less squarely than this are left out, so none crowds the limb (0.12).

measure (省略可)((text: string) => number) | undefined

The width of a name as the browser draws it, in the font the name is drawn in (a canvas's measureText): the estimate from the length is a floor, and the larger of the two is used. A machine whose font has wider letters than the estimate takes (a fallback font for Japanese, say) would otherwise lay names over one another. Left out, the estimate alone is used, as in Node.

taken (省略可)readonly { left: number; top: number; width: number; height: number; }[] | undefined

Boxes another layer's names, rings and marks already take (left, top, width and height from the picture's top left): no name is put over one.

例

import type { CityLayoutOptions } from "@johnmorrisdotca/chikyu-earth/realistic";

const options: CityLayoutOptions = { max: 24, size: 12, dot: 3 };
console.log(options.max);
24

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

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.51.1 のソースから作成しました。

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