Skip to content

@fabwcie/free-drawing / @types/toolbar

@types/toolbar ​

Type Aliases ​

AvailableTools ​

AvailableTools = WidgetName | "undo" | "redo" | "rect" | "ellipse" | "polygon" | PluginToolName

Defined in: packages/free-drawing/src/@types/toolbar.ts:36

Name of a tool (tool option, getWidget): widgets of toolbar and names kept for other tools, undo and redo (buttons of footer), rect (square draws rectangles), ellipse (circle draws ellipses), polygon (no widget)


BrushWidgetOptions ​

BrushWidgetOptions = WidgetOptions & object

Defined in: packages/free-drawing/src/@types/toolbar.ts:57

Brush options, freehand stroke settings of perfect-freehand

Type Declaration

smoothing?

optional smoothing?: number

Softness of stroke edges, from 0 to 1 (1 by default)

streamline?

optional streamline?: number

How much stroke is stabilized (follows pointer less closely), from 0 to 1 (0.5 by default)

thinning?

optional thinning?: number

Effect of drawing speed on stroke width, from -1 to 1 (0.6 by default, 0 for constant width)


FontStyleChoice ​

FontStyleChoice = TextChoice<string> & object

Defined in: packages/free-drawing/src/@types/toolbar.ts:165

Font style button of the text options: style (bold, italic) or decoration (underline, line-through)

Type Declaration

attr

attr: string

Data attribute of the button: style or decoration


FreehandSettings ​

FreehandSettings = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:103

Settings of perfect-freehand: effect of speed on width, softness of edges, stabilization

Properties ​

smoothing ​

smoothing: number

Defined in: packages/free-drawing/src/@types/toolbar.ts:107

Softness of stroke edges, from 0 to 1

streamline ​

streamline: number

Defined in: packages/free-drawing/src/@types/toolbar.ts:109

How much stroke is stabilized (follows pointer less closely), from 0 to 1

thinning ​

thinning: number

Defined in: packages/free-drawing/src/@types/toolbar.ts:105

Effect of drawing speed on stroke width, from -1 to 1 (0 for constant width)


GroupWidgetOptions ​

GroupWidgetOptions = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:91

Options of a GroupWidget created by code (the widgetGroups drawer option gives names of widgets instead)

Properties ​

icon? ​

optional icon?: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:95

Name of groupIcons or svg code, 'shapes' by default

title? ​

optional title?: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:97

Button tooltip, "More tools" translated by default

widgets ​

widgets: BaseWidget[]

Defined in: packages/free-drawing/src/@types/toolbar.ts:93

Widgets of the group, in this order (created by the app or the library, not added to toolbar yet)


OverlayOptions ​

OverlayOptions = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:149

Sections shown by an overlay and their titles, given by each subclass

Properties ​

colorTitle ​

colorTitle: TranslationKey

Defined in: packages/free-drawing/src/@types/toolbar.ts:157

Title of color section (default stroke)

fillBtns ​

fillBtns: boolean

Defined in: packages/free-drawing/src/@types/toolbar.ts:155

Show background color buttons, for rectangle and ellipse (default false)

label ​

label: TranslationKey

Defined in: packages/free-drawing/src/@types/toolbar.ts:159

Accessible name of overlay (default tool options)

styleBtns ​

styleBtns: boolean

Defined in: packages/free-drawing/src/@types/toolbar.ts:151

Show stroke style buttons (default false)

widthBtns ​

widthBtns: boolean

Defined in: packages/free-drawing/src/@types/toolbar.ts:153

Show stroke width buttons (default true)


PluginToolName ​

PluginToolName = string & Record<never, never>

Defined in: packages/free-drawing/src/@types/toolbar.ts:39

Name of a widget added by a plugin (Plugin.addWidget): any name, names of the library still suggested


SnapStops ​

SnapStops = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:171

Positions moved or resized shapes snap to (absolute), see SelectWidget snapping

Properties ​

horizontal ​

horizontal: number[]

Defined in: packages/free-drawing/src/@types/toolbar.ts:175

Y of horizontal guides

vertical ​

vertical: number[]

Defined in: packages/free-drawing/src/@types/toolbar.ts:173

X of vertical guides


ToolbarWidgetName ​

ToolbarWidgetName = WidgetName | PluginToolName

Defined in: packages/free-drawing/src/@types/toolbar.ts:42

Name of a widget of the toolbar: of the library or of a plugin


ToolOverlay ​

ToolOverlay = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:137

Options of a tool, shown while it is active (BaseOverlay and others)

Properties ​

$overlayContainer ​

$overlayContainer: HTMLElement

Defined in: packages/free-drawing/src/@types/toolbar.ts:139

Element of the overlay, in the floating region of the layout

Methods ​

hide() ​

hide(): void

Defined in: packages/free-drawing/src/@types/toolbar.ts:143

Hide overlay

Returns

void

show() ​

show(shapes?): void

Defined in: packages/free-drawing/src/@types/toolbar.ts:141

Show overlay: fields show options of given shapes (selection), else options of drawer

Parameters
shapes? ​

DrawingShape[]

Returns

void


TrailOptions ​

TrailOptions = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:115

Options of a Trail (eraser, laser), defaults: translucent black, 8 px, 200 ms, no glow

Properties ​

color ​

color: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:117

Fill color

duration ​

duration: number

Defined in: packages/free-drawing/src/@types/toolbar.ts:121

Life time of a point, in ms

glow? ​

optional glow?: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:123

Color of a glow around trail (laser), none by default

size ​

size: number

Defined in: packages/free-drawing/src/@types/toolbar.ts:119

Width at pointer, in screen pixels (same whatever zoom)


TrailPoint ​

TrailPoint = Vector2d & object

Defined in: packages/free-drawing/src/@types/toolbar.ts:129

Point of a Trail: position in drawing and time it was added, removed after the duration of the trail

Type Declaration

time

time: number

Time it was added (ms)


UpdateBatch ​

UpdateBatch = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:179

Updates of the selection grouped in one change (see SelectWidget.batchUpdates)

Properties ​

changed ​

changed: boolean

Defined in: packages/free-drawing/src/@types/toolbar.ts:181

A selected shape changed: change fired at the end


WidgetGroupOptions ​

WidgetGroupOptions = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:69

Group of toolbar widgets (widgetGroups option): one button showing its widgets, at the place of the first one

Properties ​

icon? ​

optional icon?: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:73

Icon: 'shapes' (default), 'more', 'grid', 'plus', name of a widget (e.g. 'square') or svg code

title? ​

optional title?: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:75

Button tooltip, "More tools" translated by default

widgets ​

widgets: ToolbarWidgetName[]

Defined in: packages/free-drawing/src/@types/toolbar.ts:71

Widgets of the group, in this order: widgets of widgets option (or of plugins) only, each one in one group


WidgetName ​

WidgetName = "pan" | "selection" | "brush" | "eraser" | "text" | "note" | "line" | "square" | "circle" | "arrow" | "image" | "triangle" | "diamond" | "laser" | "frame"

Defined in: packages/free-drawing/src/@types/toolbar.ts:14

Widgets of toolbar: pan (move the view), selection (select, move, resize, rotate), brush (freehand stroke), eraser, text (edited in place), note, line, square (rectangle, square with Shift), circle (ellipse, circle with Shift), arrow (ends linked to shapes), image, triangle, diamond, laser (trail following pointer, not saved), frame (holds shapes, with a title). Heart, cloud, star, hexagon, block arrow, speech bubble, check box and highlighter: plugins of @fabwcie/free-drawing-extra-tools


WidgetOptions ​

WidgetOptions = object

Defined in: packages/free-drawing/src/@types/toolbar.ts:47

Options of every widget

Properties ​

shortcut? ​

optional shortcut?: string | false

Defined in: packages/free-drawing/src/@types/toolbar.ts:51

Keyboard shortcut (a key), false to disable it

title? ​

optional title?: string

Defined in: packages/free-drawing/src/@types/toolbar.ts:49

Button tooltip (e.g. translation)


WidgetsOptions ​

WidgetsOptions = ToolbarWidgetName[] | Partial<Record<ToolbarWidgetName, WidgetOptions>> & object

Defined in: packages/free-drawing/src/@types/toolbar.ts:81

Widgets option: list of widgets or object of widgets options, toolbar keeps the given order