Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/ui/pathgizmo

PathGizmo and PenTool: edit and draw Bezier paths.

import { PathGizmo, PenTool } from 'pixi-silk/ui/pathgizmo';

Classes#

ClassDescription
PathGizmoEdits a cubic bezier path: anchors, handles and segments, plus a pen tool that adds anchors.
PenToolThe pen tool’s state machine, without pointer events or drawing: feed it presses, moves and releases in path coordinates and read the path back. A click adds a corner. A drag pulls out mirrored handles, and Alt moves only the outgoing one. A click on the first anchor closes the path, and a click on the last one drops its outgoing handle. PathGizmo drives one.

Interfaces#

InterfaceDescription
PathGizmoOptionsOptions of PathGizmo.
PathGizmoStateThe signals of a PathGizmo.
PathGizmoThemeColours of a PathGizmo (any Pixi colour).
PathSnapInfoWhat is being snapped, as the snap option gets it.
PenInputWhat the pointer is on and which modifiers are down, for PenTool.
PenToolOptionsOptions of PenTool.

Type Aliases#

Type AliasDescription
PathHitA part of the path under the pointer. index is an anchor index. A segment hit has the curve parameter t (0 to 1) and the nearest point (x, y) in path coordinates.
PathToolThe two modes of a PathGizmo.
PenPhaseWhere the pen tool is. - idle: not drawing. The next click starts or continues the path. - drawing: the next click adds an anchor. - dragging: the button is down on the newly placed anchor, and the drag pulls out its handles. - closing: the click closed the path, and the drag shapes the first anchor.

Variables#

VariableDescription
PATH_GIZMO_THEMEDefault theme: a blue outline with white anchors. Override single colours with the theme option.