@fabwcie/free-drawing / components/toolbar/widgets/GroupWidget
components/toolbar/widgets/GroupWidget
Classes
GroupWidget
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:109
Group of toolbar widgets: one button (generic icon by default) shows its widgets above it, highlighted while one of them is active. Its widgets are still widgets of the toolbar (shortcuts, help, command palette, read only), added with it by toolbar.addGroup.
Constructors
Constructor
new GroupWidget(
drawer,__namedParameters):GroupWidget
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:125
Create the group button and the menu of its widgets
Parameters
drawer
Drawer of this group
__namedParameters
Returns
Properties
$button
readonly$button:HTMLButtonElement
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:117
Button showing / hiding the menu (disclosure), highlighted while a widget of group is active
$container
readonly$container:HTMLDivElement
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:115
Container of group button and menu in toolbar
$menu
readonly$menu:HTMLDivElement
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:119
Menu of widget buttons (role group), above group button in fixed position, hidden until shown
drawer
readonlydrawer:Drawer
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:111
Drawer of this group
widgets
readonlywidgets:BaseWidget[]
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:113
Widgets of the group, in menu order
Methods
_initEvents()
private_initEvents():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:237
Button toggles widgets, arrow keys move between them (Up / Down: to the line above or below), Escape closes them (focus back on button), closed when a widget is chosen, focus or pointer goes elsewhere, footer scrolls or window is resized
Returns
void
_place()
private_place():void
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:216
Widgets above group button, in drawer: fixed position, not cut by footer (scrolled on narrow screens)
Returns
void
addTo()
addTo(
parent):void
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:164
Internal
Adds group button and its widgets to parent (toolbar)
Parameters
parent
HTMLElement
Toolbar root receiving the group container
Returns
void
hide()
hide():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:193
Hide widgets (widget chosen, Escape, focus or pointer elsewhere, footer scrolled, window resized)
Returns
void
isShown()
isShown():
boolean
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:173
Menu of widgets is shown
Returns
boolean
True while the menu is not hidden
show()
show():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:180
Show widgets, focus on active one (else first one): arrow keys move between them
Returns
void
update()
update():
void
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:201
Button highlighted while a widget of group is active, disabled when all its widgets are (read only)
Returns
void
Variables
groupColumns
constgroupColumns:4=4
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:32
Widgets per line of the menu of a group, at most
groupIcons
constgroupIcons:Record<string,string>
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:37
Icons of groups by name: generic ones, then icons of widgets
Functions
getGroupIcon()
getGroupIcon(
icon?):SVGElement
Defined in: packages/free-drawing/src/components/toolbar/widgets/GroupWidget.ts:86
Icon of a group: name of groupIcons or svg code, default icon for an unknown name or invalid code
Parameters
icon?
string = 'shapes'
Name of groupIcons or svg markup, 'shapes' by default
Returns
SVGElement
Decorative svg element (hidden to assistive technologies)