Reference · The realistic Earth's pure parts
CityLayoutOptionstype
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 it
import type { CityLayoutOptions } from "@johnmorrisdotca/chikyu-earth/realistic";
Definition
interface CityLayoutOptions {
max: number;
size: number;
dot: number;
facing?: number;
measure?: (text: string) => number;
taken?: readonly {
left: number;
top: number;
width: number;
height: number;
}[];
}
Members
| Name | Type | Description |
|---|---|---|
max | number | |
size | number | |
dot | number | |
facing (optional) | number | undefined | Cities that face the viewer less squarely than this are left out, so none crowds the limb (0.12). |
measure (optional) | ((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 |
taken (optional) | 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. |
Examples
import type { CityLayoutOptions } from "@johnmorrisdotca/chikyu-earth/realistic";
const options: CityLayoutOptions = { max: 24, size: 12, dot: 3 };
console.log(options.max);24What it prints (run when this page was built)