Reference · Framing, geometry and quiz tools
ChizuPortPlacedtype
A placed mark: where it is on the canvas, in the copy of the canvas it was drawn in.
Import it
import type { ChizuPortPlaced } from "@johnmorrisdotca/chizu";
Definition
type ChizuPortPlaced = {
port: ChizuPort;
x: number;
y: number;
};
Members
| Name | Type | Description |
|---|---|---|
port | ChizuPort | |
x | number | |
y | number |
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { placePorts, wholeMapBox, type ChizuPortPlaced } from "@johnmorrisdotca/chizu";
const kobe = { id: "kobe", kind: "harbour", name: { en: "Kobe" }, country: "JP", lat: 34.68, lon: 135.2, tier: 1 } as const;
const placed: ChizuPortPlaced[] = placePorts(WORLD, [kobe], wholeMapBox(WORLD), [0]);
console.log(placed[0]?.port.id, placed.length);
// kobe 1kobe 1What it prints (run when this page was built)