Skip to content
pixi-silk
GitHub repository
Entry point

pixi-silk/ui/ruler

Ruler: screen-edge rulers that follow the camera.

import { Ruler, niceStep, tickDivisions } from 'pixi-silk/ui/ruler';

Classes#

ClassDescription
RulerTop and left rulers for a Camera. Ticks and labels adapt to the zoom in 1, 2, 5 steps, and labels fade as steps change. The highlighted extent shows as a band with its edges labelled in the accent colour. A marker follows the pointer.

Interfaces#

InterfaceDescription
RulerOptionsOptions of Ruler.
RulerStateThe reactive state of a Ruler.

Type Aliases#

Type AliasDescription
RulerSideWhich bar of a Ruler a point is on. corner is the square where both bars meet.
RulerTargetWhat a Ruler highlights: objects, followed every frame through their axis-aligned bounds, or a fixed rectangle in world units.

Functions#

FunctionDescription
niceStepThe nice step (1, 2 or 5 times a power of ten) at or above min. Returns 1 for 0, negative or infinite input.
tickDivisionsMinor ticks per label step from niceStep: 4 when the step is 2 times a power of ten, else 5.