Skip to content
pixi-silk
GitHub repository
Interface

RulerOptions

import type { RulerOptions } from 'pixi-silk/ui/ruler';

Options of Ruler.

Properties#

PropertyTypeDescriptionDefined in
accent?ColorSourceColour of the selection band, its edge labels and the cursor marker. Default 0x0a84ff.ui/ruler.ts:35
background?ColorSourceBar background. Default 0x1c1c1e.ui/ruler.ts:29
cameraCameraThe camera the ruler reads. The ruler redraws whenever the camera’s signals change.ui/ruler.ts:23
fontSize?numberLabel font size in pixels. Default 10.ui/ruler.ts:39
format?(value: number, step: number) => stringTurns a world value into a label. step is the distance between labels. Default whole numbers, or as many decimals as a step below 1 needs (at most 6).ui/ruler.ts:44
label?LabelFactoryBuilds the label text. Default a PixiJS Text at resolution 3. Pass silkLabel() from pixi-silk/text to draw labels as SDF text instead.ui/ruler.ts:49
labelSpacing?numberSmallest distance between labels in CSS pixels. Default 72. The step rounds up to 1, 2 or 5 times a power of ten.ui/ruler.ts:37
sides?"left" | "top" | "both"Which rulers to draw. Default both.ui/ruler.ts:25
size?numberBar thickness in CSS pixels. Default 20.ui/ruler.ts:27
textColor?ColorSourceLabel colour. Default 0x8e8e93.ui/ruler.ts:33
tickColor?ColorSourceTick colour, drawn at 28% opacity. Default white.ui/ruler.ts:31
ticker?Ticker | nullTicker that runs fades and redraws. Default Ticker.shared. With null, call Ruler.tick yourself.ui/ruler.ts:53
trackCursor?booleanFollows the pointer over the camera’s element with a marker. Adds pointer listeners to the element. Default true.ui/ruler.ts:51