SnapEngine and SnapGuides: snap boxes to edges, centres and lines.
import { SnapEngine, SnapGuides } from 'pixi-silk/ui/snap';
Classes#
| Class | Description |
|---|
| SnapEngine | Pure snapping maths, no drawing. It moves a rectangle so its edges or centre line up with other rectangles, guide lines and points, or so it sits at an equal gap from its neighbours. Each axis picks the nearest candidate within the threshold. Works in whatever space the rectangles are given in, axis-aligned only. Change the properties at any time. |
| SnapGuides | Draws what a SnapEngine found: dashed alignment lines with end marks, and equal-gap markers with their distance in a pill. Each alignment fades in when found and out when lost, so the guides never slide from one alignment to the next. Add it to the same space as the rectangles you snap. It ignores pointer events. |
Interfaces#