Reference · Framing, geometry and quiz tools
ChizuLocalMarkertype
A picture placed on a local map: where it is on the canvas, how many canvas units a unit of the picture is, and the
turn that puts its top towards its bearing (the bearing less the map's grid convergence, localConvergence).
Import it
import type { ChizuLocalMarker } from "@johnmorrisdotca/chizu";
Definition
type ChizuLocalMarker = {
id: string;
name?: string;
nameJa?: string;
classes: string[];
at: [
number,
number
];
bearing: number;
rotation: number;
scale: number;
anchor: [
number,
number
];
viewBox: [
number,
number,
number,
number
];
markup: string;
bbox: [
number,
number,
number,
number
];
};
Members
| Name | Type | Description |
|---|---|---|
id | string | |
name (optional) | string | undefined | |
nameJa (optional) | string | undefined | |
classes | string[] | |
at | [number, number] | Where its anchor is on the canvas. |
bearing | number | The bearing it was given. |
rotation | number | The turn on the canvas, in degrees clockwise. |
scale | number | Canvas units to a unit of the picture. |
anchor | [number, number] | The point of the picture that sits on |
viewBox | [number, number, number, number] | The picture's window: |
markup | string | The cleaned markup, ready to sit in an |
bbox | [number, number, number, number] | The box round the turned picture on the canvas: left, top, right, bottom. |
Examples
import { localMap, type ChizuLocalMarker } from "@johnmorrisdotca/chizu";
const field = '<svg viewBox="0 0 100 50"><rect width="100" height="50"/></svg>';
const marker: ChizuLocalMarker = localMap({ centre: [139.7, 35.7], widthMetres: 400, markers: [{ at: [139.7, 35.7], svg: field, bearing: 90 }] }).markers[0]!;
console.log(marker.id, marker.scale, marker.rotation);
// marker-1 2.5 90marker-1 2.5 90What it prints (run when this page was built)