Reference · Framing, geometry and quiz tools
shiftedOutlinesfunction
Copies of the outlines translated horizontally by the supplied map-unit offset.
Import it
import { shiftedOutlines } from "@johnmorrisdotca/chizu";
Definition
function shiftedOutlines(outlines: readonly MapOutline[], by: number): MapOutline[]
Parameters
| Name | Type | Description |
|---|---|---|
outlines | readonly MapOutline[] | Native parsed region outlines, including their region identifiers. |
by | number | The second segment endpoint’s vertical map coordinate. |
Returns
MapOutline[]
Copies of the outlines translated horizontally by the supplied map-unit offset.
Examples
import WORLD from "@johnmorrisdotca/chizu/world";
import { mapOutlines, shiftedOutlines } from "@johnmorrisdotca/chizu";
// The world's outlines one turn of the earth to the east, for the copy drawn beside it.
const shifted = shiftedOutlines(mapOutlines(WORLD), WORLD.width);
console.log(Math.round(shifted[0]!.rings[0]!.minX - mapOutlines(WORLD)[0]!.rings[0]!.minX));
// 10001000What it prints (run when this page was built)