Reference · Framing, geometry and quiz tools
focusBoxfunction
The window that frames these regions, or the whole map when none are given.
Import it
import { focusBox } from "@johnmorrisdotca/chizu";
Definition
function focusBox(map: Frameable, codes: ReadonlyArray<string | number>): MapBox
Parameters
| Name | Type | Description |
|---|---|---|
map | Frameable | The native map or map fields required by this signature; coordinates and region codes belong to its canvas. |
codes | readonly (string | number)[] | Native region codes from this map, in the requested order. |
Returns
MapBox
The window that frames these regions, or the whole map when none are given.
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { boxToViewBox, focusBox } from "@johnmorrisdotca/chizu";
console.log(boxToViewBox(focusBox(WORLD, ["DE", "PL"])).split(" ").map((n) => Math.round(Number(n))).join(" "));
// 1 50 220 2201 50 220 220What it prints (run when this page was built)