Reference · Framing, geometry and quiz tools
HandleBoundstype
A box the handles should stay inside, so none is cropped at the frame edge.
Import it
import type { HandleBounds } from "@johnmorrisdotca/chizu";
Definition
type HandleBounds = {
x: number;
y: number;
width: number;
height: number;
};
Members
| Name | Type | Description |
|---|---|---|
x | number | |
y | number | |
width | number | |
height | number |
Examples
import { placeHandles, type HandleBounds } from "@johnmorrisdotca/chizu";
const bounds: HandleBounds = { x: 0, y: 0, width: 100, height: 100 };
const spots = placeHandles([{ item: "a", centroid: [50, 50] }, { item: "b", centroid: [55, 50] }], 5, bounds);
console.log(spots.every((spot) => spot.hx >= 0 && spot.hx <= 100 && spot.hy >= 0 && spot.hy <= 100));
// truetrueWhat it prints (run when this page was built)