Abstract Class: CommentBarButton
Defined in: packages/blockly/core/comments/comment_bar_button.ts:17
Button displayed on a comment's top bar.
Extended by
Implements
Properties index
| Property | Description |
|---|---|
| icon | SVG image displayed on this button. |
| id | The ID of this button's parent comment. |
| workspace | The workspace this button's parent comment is on. |
| container | An SVG group that this button should be a child of. |
| commentView | - |
Methods index
| Method | Description |
|---|---|
| isVisible | Returns whether or not this button is currently visible. |
| getCommentView | Returns the parent comment view of this comment bar button. |
| reposition | Adjusts the position of this button within its parent container. |
| performAction | Perform the action this button should take when it is acted on. |
| getSize | Returns the dimensions of this button in workspace coordinates. |
| getMargin | Returns the margin in workspace coordinates surrounding this button. |
| getFocusableElement | Returns a DOM element representing this button that can receive focus. |
| getFocusableTree | Returns the workspace this button is a child of. |
| onNodeFocus | Called when this button's focusable DOM element gains focus. |
| onNodeBlur | Called when this button's focusable DOM element loses focus. |
| canBeFocused | Returns whether this button can be focused. True if it is visible. |
| recomputeAriaContext | Recomputes the ARIA label and role for this button. Note that this is not automatically called during initialization and must be called once a button's focusable element (icon) is initialized. Implementations may also find it useful to call this if the button's label should be changed. |
| getAriaLabel | Returns the ARIA label to use for this button (defaults to null). Note that this method will only be called and apply when recomputeAriaContext is called. |
Constructors
Constructor
new CommentBarButton(
id,
workspace,
container,
commentView
): CommentBarButton;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:30
Creates a new CommentBarButton instance.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of this button's parent comment. |
workspace | WorkspaceSvg | The workspace this button's parent comment is on. |
container | SVGGElement | An SVG group that this button should be a child of. |
commentView | CommentView | - |
Returns
CommentBarButton
Properties
icon
abstract protected readonly icon: SVGImageElement;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:21
SVG image displayed on this button.
id
readonly id: string;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:31
The ID of this button's parent comment.
workspace
protected readonly workspace: WorkspaceSvg;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:32
The workspace this button's parent comment is on.
container
protected readonly container: SVGGElement;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:33
An SVG group that this button should be a child of.
commentView
protected readonly commentView: CommentView;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:34
Methods
isVisible()
isVisible(): boolean;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:40
Returns whether or not this button is currently visible.
Returns
boolean
getCommentView()
getCommentView(): CommentView;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:47
Returns the parent comment view of this comment bar button.
Returns
reposition()
abstract reposition(): void;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:52
Adjusts the position of this button within its parent container.
Returns
void
performAction()
abstract performAction(e?): void;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:55
Perform the action this button should take when it is acted on.
Parameters
| Parameter | Type |
|---|---|
e? | Event |
Returns
void
Implementation of
getSize()
getSize(includeMargin?): Rect;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:63
Returns the dimensions of this button in workspace coordinates.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
includeMargin | boolean | false | True to include the margin when calculating the size. |
Returns
The size of this button.
getMargin()
getMargin(): number;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:77
Returns the margin in workspace coordinates surrounding this button.
Returns
number
getFocusableElement()
getFocusableElement(): SVGImageElement;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:82
Returns a DOM element representing this button that can receive focus.
Returns
SVGImageElement
Implementation of
IFocusableNode.getFocusableElement
getFocusableTree()
getFocusableTree(): WorkspaceSvg;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:87
Returns the workspace this button is a child of.
Returns
Implementation of
IFocusableNode.getFocusableTree
onNodeFocus()
onNodeFocus(): void;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:92
Called when this button's focusable DOM element gains focus.
Returns
void
Implementation of
onNodeBlur()
onNodeBlur(): void;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:101
Called when this button's focusable DOM element loses focus.
Returns
void
Implementation of
canBeFocused()
canBeFocused(): boolean;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:104
Returns whether this button can be focused. True if it is visible.
Returns
boolean
Implementation of
recomputeAriaContext()
protected recomputeAriaContext(): void;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:114
Recomputes the ARIA label and role for this button. Note that this is not automatically called during initialization and must be called once a button's focusable element (icon) is initialized. Implementations may also find it useful to call this if the button's label should be changed.
Returns
void
getAriaLabel()
protected getAriaLabel(): string | null;
Defined in: packages/blockly/core/comments/comment_bar_button.ts:133
Returns the ARIA label to use for this button (defaults to null). Note that this method will only be called and apply when recomputeAriaContext is called.
Returns
string | null
The ARIA label to use for this button, or null to use a default.