Reference · Framing, geometry and quiz tools
stepMapZoomfunction
One step in or out, clamped: the ends stay put rather than wrapping.
Import it
import { stepMapZoom } from "@johnmorrisdotca/chizu";
Definition
function stepMapZoom(zoom: MapZoom, by: 1 | -1): MapZoom
Parameters
| Name | Type | Description |
|---|---|---|
zoom | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | A valid zoom step from MAP_ZOOM_LEVELS. |
by | 1 | -1 | The second segment endpoint’s vertical map coordinate. |
Returns
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
One step in or out, clamped: the ends stay put rather than wrapping.
Examples
import { stepMapZoom } from "@johnmorrisdotca/chizu";
console.log(stepMapZoom(1, 1), stepMapZoom(10, 1), stepMapZoom(1, -1));
// 2 10 12 10 1What it prints (run when this page was built)