Skip to content

@fabwcie/free-drawing / utils/widgets

utils/widgets ​

Functions ​

getWidgetGroups() ​

getWidgetGroups(groups, names): WidgetGroupOptions[]

Defined in: packages/free-drawing/src/utils/widgets.ts:41

Groups of widgets option with widgets of toolbar only (a widget in one group), groups without widgets ignored

Parameters

groups

WidgetGroupOptions[]

widgetGroups option

names

ToolbarWidgetName[]

Widgets of toolbar

Returns

WidgetGroupOptions[]

copies of the groups with their valid widgets (a widget only in its first group)


getWidgetNames() ​

getWidgetNames(widgets, known?): ToolbarWidgetName[]

Defined in: packages/free-drawing/src/utils/widgets.ts:16

Names of widgets option (list or object), in given order, unknown names are ignored

Parameters

widgets

WidgetsOptions

widgets option: list of names, or options by name

known?

readonly ToolbarWidgetName[] = widgetNames

Names of existing widgets: of the library, and of plugins

Returns

ToolbarWidgetName[]

known widget names (a warning for each unknown one)


getWidgetOptions() ​

getWidgetOptions<T>(widgets, id): T

Defined in: packages/free-drawing/src/utils/widgets.ts:62

Options of a widget from widgets option (empty with list form)

Type Parameters

T

T extends WidgetOptions = WidgetOptions

Parameters

widgets

WidgetsOptions

widgets option: list of names, or options by name

id

AvailableTools

name of the widget

Returns

T

options given for the widget, empty object when none