Reference · Framing, geometry and quiz tools
boxCentrefunction
Where a box is looking, which is what a zoom step keeps hold of.
Import it
import { boxCentre } from "@johnmorrisdotca/chizu";
Definition
function boxCentre(box: MapBox): { x: number; y: number; }
Parameters
| Name | Type | Description |
|---|---|---|
box | MapBox | The window in native map units, or the inset destination specified by this signature. |
Returns
{ x: number; y: number; }
Where a box is looking, which is what a zoom step keeps hold of.
Examples
import { boxCentre } from "@johnmorrisdotca/chizu";
console.log(boxCentre({ x: 100, y: 50, width: 200, height: 100 }));
// { x: 200, y: 100 }{ x: 200, y: 100 }What it prints (run when this page was built)