Reference · Framing, geometry and quiz tools
MapBoxtype
A window on a map, in the map's own units: what an SVG viewBox says.
Import it
import type { MapBox } from "@johnmorrisdotca/chizu";
Definition
type MapBox = {
x: number;
y: number;
width: number;
height: number;
};
Members
| Name | Type | Description |
|---|---|---|
x | number | |
y | number | |
width | number | |
height | number |
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { boxToViewBox, type MapBox } from "@johnmorrisdotca/chizu";
const window: MapBox = { x: 0, y: 0, width: WORLD.width / 2, height: WORLD.height / 2 };
console.log(boxToViewBox(window));
// 0 0 500 244.50 0 500 244.5What it prints (run when this page was built)