Class: MiniWorkspaceBubble
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:26
A bubble that contains a mini-workspace which can hold arbitrary blocks. Used by the mutator icon.
Extends
Properties index
| Property | Description |
|---|---|
| BORDER_WIDTH | The width of the border around the bubble. |
| DOUBLE_BORDER | Double the width of the border around the bubble. |
| MIN_SIZE | The minimum size the bubble can have. |
| TAIL_THICKNESS | The thickness of the base of the tail in relation to the size of the bubble. Higher numbers result in thinner tails. |
| TAIL_ANGLE | The number of degrees that the tail bends counter-clockwise. |
| TAIL_BEND | The sharpness of the tail's bend. Higher numbers result in smoother tails. |
| ANCHOR_RADIUS | Distance between arrow point and anchor point. |
| id | - |
| svgRoot | The SVG group containing all parts of the bubble. |
| contentContainer | The SVG group containing the contents of the bubble. |
| disposed | True if the bubble has been disposed, false otherwise. |
| workspace | The workspace this bubble belongs to. |
| anchor | The anchor location of the thing this bubble is attached to. The tail of the bubble will point to this location. |
| ownerRect | An optional rect we don't want the bubble to overlap with when automatically positioning. |
| owner | The object responsible for hosting/spawning this bubble. |
Methods index
| Method | Description |
|---|---|
| setAnchorLocation | Set the location the tail of this bubble points to. |
| setPositionRelativeToAnchor | Sets the position of this bubble relative to its anchor. |
| getSize | Returns the size of this bubble. |
| setSize | Sets the size of this bubble, including the border. |
| getColour | Returns the colour of the background and tail of this bubble. |
| setColour | Sets the colour of the background and tail of this bubble. |
| onKeyDown | Handles key events when this bubble is focused. By default, closes the bubble on Escape. |
| positionRelativeToAnchor | Positions the bubble relative to its anchor. Does not render its tail. |
| moveBy | Moves the bubble by the given amounts in the x and y directions. |
| positionByRect | Positions the bubble "optimally" so that the most of it is visible and it does not overlap the rect (if provided). |
| getBoundingRectangle | Returns the bounds of this bubble. |
| setDragging | Sets whether or not this bubble is being dragged. |
| isMovable | Returns whether this bubble is movable or not. |
| startDrag | Starts a drag on the bubble. |
| drag | Drags the bubble to the given location. |
| endDrag | Ends the drag on the bubble. |
| revertDrag | Moves the bubble back to where it was at the start of a drag. |
| select | Select this. Highlight it visually. |
| unselect | Unselect this. Unhighlight it visually. |
| getFocusableElement | See IFocusableNode.getFocusableElement. |
| getFocusableTree | See IFocusableNode.getFocusableTree. |
| onNodeFocus | See IFocusableNode.onNodeFocus. |
| onNodeBlur | See IFocusableNode.onNodeBlur. |
| canBeFocused | See IFocusableNode.canBeFocused. |
| getOwner | Returns the object that owns/hosts this bubble, if any. |
| recomputeAriaContext | Recomputes the ARIA label and role for this bubble. This is automatically called during initialization, but implementations may find it useful to call this if the bubble's label should be changed. |
| setAriaLabelProvider | Sets a custom ARIA label provider for this bubble, or null if it should be reset to use the default method. |
| getAriaLabel | Returns the ARIA label to use for this bubble based on the provider set via setAriaLabelProvider. This will return null if the provider is absent or returns null. |
| dispose | Dispose of this bubble. |
| addWorkspaceChangeListener | Adds a change listener to the mini workspace. |
| updateBlockStyles | Reapplies styles to all of the blocks in the mini workspace. |
| performAction | Handles the user acting on this bubble via keyboard navigation by focusing the mutator workspace. |
Properties
BORDER_WIDTH
readonly static BORDER_WIDTH: 6 = 6;
Defined in: packages/blockly/core/bubbles/bubble.ts:46
The width of the border around the bubble.
Inherited from
DOUBLE_BORDER
readonly static DOUBLE_BORDER: number;
Defined in: packages/blockly/core/bubbles/bubble.ts:49
Double the width of the border around the bubble.
Inherited from
MIN_SIZE
readonly static MIN_SIZE: number;
Defined in: packages/blockly/core/bubbles/bubble.ts:52
The minimum size the bubble can have.
Inherited from
TAIL_THICKNESS
readonly static TAIL_THICKNESS: 1 = 1;
Defined in: packages/blockly/core/bubbles/bubble.ts:58
The thickness of the base of the tail in relation to the size of the bubble. Higher numbers result in thinner tails.
Inherited from
TAIL_ANGLE
readonly static TAIL_ANGLE: 20 = 20;
Defined in: packages/blockly/core/bubbles/bubble.ts:61
The number of degrees that the tail bends counter-clockwise.
Inherited from
TAIL_BEND
readonly static TAIL_BEND: 4 = 4;
Defined in: packages/blockly/core/bubbles/bubble.ts:67
The sharpness of the tail's bend. Higher numbers result in smoother tails.
Inherited from
ANCHOR_RADIUS
readonly static ANCHOR_RADIUS: 8 = 8;
Defined in: packages/blockly/core/bubbles/bubble.ts:70
Distance between arrow point and anchor point.
Inherited from
id
id: string;
Defined in: packages/blockly/core/bubbles/bubble.ts:72
Inherited from
svgRoot
protected svgRoot: SVGGElement;
Defined in: packages/blockly/core/bubbles/bubble.ts:75
The SVG group containing all parts of the bubble.
Inherited from
contentContainer
protected contentContainer: SVGGElement;
Defined in: packages/blockly/core/bubbles/bubble.ts:84
The SVG group containing the contents of the bubble.
Inherited from
disposed
disposed: boolean = false;
Defined in: packages/blockly/core/bubbles/bubble.ts:95
True if the bubble has been disposed, false otherwise.
Inherited from
workspace
readonly workspace: WorkspaceSvg;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:54
The workspace this bubble belongs to.
Inherited from
anchor
protected anchor: Coordinate;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:55
The anchor location of the thing this bubble is attached to. The tail of the bubble will point to this location.
Inherited from
ownerRect?
protected optional ownerRect?: Rect;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:56
An optional rect we don't want the bubble to overlap with when automatically positioning.
Inherited from
owner?
protected optional owner?: IHasBubble & IFocusableNode;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:57
The object responsible for hosting/spawning this bubble.
Inherited from
Methods
setAnchorLocation()
setAnchorLocation(anchor, relayout?): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:193
Set the location the tail of this bubble points to.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
anchor | Coordinate | undefined | The location the tail of this bubble points to. |
relayout | boolean | false | If true, reposition the bubble from scratch so that it is optimally visible. If false, reposition it so it maintains the same position relative to the anchor. |
Returns
void
Inherited from
setPositionRelativeToAnchor()
setPositionRelativeToAnchor(left, top): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:204
Sets the position of this bubble relative to its anchor.
Parameters
| Parameter | Type |
|---|---|
left | number |
top | number |
Returns
void
Inherited from
Bubble.setPositionRelativeToAnchor
getSize()
protected getSize(): Size;
Defined in: packages/blockly/core/bubbles/bubble.ts:212
Returns
the size of this bubble.
Inherited from
setSize()
protected setSize(size, relayout?): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:224
Sets the size of this bubble, including the border.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
size | Size | undefined | Sets the size of this bubble, including the border. |
relayout | boolean | false | If true, reposition the bubble from scratch so that it is optimally visible. If false, reposition it so it maintains the same position relative to the anchor. |
Returns
void
Inherited from
getColour()
protected getColour(): string;
Defined in: packages/blockly/core/bubbles/bubble.ts:241
Returns the colour of the background and tail of this bubble.
Returns
string
Inherited from
setColour()
setColour(colour): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:246
Sets the colour of the background and tail of this bubble.
Parameters
| Parameter | Type |
|---|---|
colour | string |
Returns
void
Inherited from
onKeyDown()
protected onKeyDown(e): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:267
Handles key events when this bubble is focused. By default, closes the bubble on Escape.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | KeyboardEvent | The keyboard event to handle. |
Returns
void
Inherited from
positionRelativeToAnchor()
protected positionRelativeToAnchor(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:275
Positions the bubble relative to its anchor. Does not render its tail.
Returns
void
Inherited from
Bubble.positionRelativeToAnchor
moveBy()
moveBy(
dx,
dy,
_reason?
): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:302
Moves the bubble by the given amounts in the x and y directions.
Parameters
| Parameter | Type | Description |
|---|---|---|
dx | number | The distance to move along the x axis. |
dy | number | The distance to move along the y axis. |
_reason? | string[] | A description of why this move is happening. |
Returns
void
Inherited from
positionByRect()
protected positionByRect(rect?): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:311
Positions the bubble "optimally" so that the most of it is visible and it does not overlap the rect (if provided).
Parameters
| Parameter | Type |
|---|---|
rect | Rect |
Returns
void
Inherited from
getBoundingRectangle()
getBoundingRectangle(): Rect;
Defined in: packages/blockly/core/bubbles/bubble.ts:655
Returns the bounds of this bubble.
Returns
A bounding box for this bubble.
Inherited from
setDragging()
setDragging(_start): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:687
Sets whether or not this bubble is being dragged.
Parameters
| Parameter | Type |
|---|---|
_start | boolean |
Returns
void
Inherited from
isMovable()
isMovable(): boolean;
Defined in: packages/blockly/core/bubbles/bubble.ts:707
Returns whether this bubble is movable or not.
Returns
boolean
Inherited from
startDrag()
startDrag(): IBubble;
Defined in: packages/blockly/core/bubbles/bubble.ts:712
Starts a drag on the bubble.
Returns
Inherited from
drag()
drag(newLoc): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:717
Drags the bubble to the given location.
Parameters
| Parameter | Type |
|---|---|
newLoc | Coordinate |
Returns
void
Inherited from
endDrag()
endDrag(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:722
Ends the drag on the bubble.
Returns
void
Inherited from
revertDrag()
revertDrag(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:727
Moves the bubble back to where it was at the start of a drag.
Returns
void
Inherited from
select()
select(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:731
Select this. Highlight it visually.
Returns
void
Inherited from
unselect()
unselect(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:736
Unselect this. Unhighlight it visually.
Returns
void
Inherited from
getFocusableElement()
getFocusableElement(): HTMLElement | SVGElement;
Defined in: packages/blockly/core/bubbles/bubble.ts:742
See IFocusableNode.getFocusableElement.
Returns
HTMLElement | SVGElement
Inherited from
getFocusableTree()
getFocusableTree(): IFocusableTree;
Defined in: packages/blockly/core/bubbles/bubble.ts:747
See IFocusableNode.getFocusableTree.
Returns
Inherited from
onNodeFocus()
onNodeFocus(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:752
See IFocusableNode.onNodeFocus.
Returns
void
Inherited from
onNodeBlur()
onNodeBlur(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:762
See IFocusableNode.onNodeBlur.
Returns
void
Inherited from
canBeFocused()
canBeFocused(): boolean;
Defined in: packages/blockly/core/bubbles/bubble.ts:767
See IFocusableNode.canBeFocused.
Returns
boolean
Inherited from
getOwner()
getOwner():
| IHasBubble & IFocusableNode
| undefined;
Defined in: packages/blockly/core/bubbles/bubble.ts:774
Returns the object that owns/hosts this bubble, if any.
Returns
| IHasBubble & IFocusableNode
| undefined
Inherited from
recomputeAriaContext()
protected recomputeAriaContext(): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:787
Recomputes the ARIA label and role for this bubble. This is automatically called during initialization, but implementations may find it useful to call this if the bubble's label should be changed.
Bubbles use a default non-specific label unless they're customized otherwise which is the responsibility of the bubble's owner rather than bubble implementations. Customization can be done via setAriaLabelProvider.
Returns
void
Inherited from
setAriaLabelProvider()
setAriaLabelProvider(provider): void;
Defined in: packages/blockly/core/bubbles/bubble.ts:815
Sets a custom ARIA label provider for this bubble, or null if it should be reset to use the default method.
Bubbles do not compute ARIA labels specifically to their implementation since they can be rather general-purpose. Instead, owners of the specific bubble instance (such as an icon) are responsible for defining custom label providers for their bubbles.
Note that calling this isn't sufficient for it to actually be used. recomputeAriaContext will likely also need to be called to actually apply the custom label to the bubble's focusable element.
Parameters
| Parameter | Type |
|---|---|
provider | AriaLabelProvider | null |
Returns
void
Inherited from
getAriaLabel()
getAriaLabel(): string | null;
Defined in: packages/blockly/core/bubbles/bubble.ts:827
Returns the ARIA label to use for this bubble based on the provider set via setAriaLabelProvider. This will return null if the provider is absent or returns null.
Returns
string | null
The ARIA label to use for this bubble, or null if one is not provided.
Inherited from
dispose()
dispose(): void;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:97
Dispose of this bubble.
Returns
void
Overrides
addWorkspaceChangeListener()
addWorkspaceChangeListener(listener): void;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:108
Adds a change listener to the mini workspace.
Parameters
| Parameter | Type |
|---|---|
listener | (e) => void |
Returns
void
updateBlockStyles()
updateBlockStyles(): void;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:256
Reapplies styles to all of the blocks in the mini workspace.
Returns
void
performAction()
performAction(): void;
Defined in: packages/blockly/core/bubbles/mini_workspace_bubble.ts:299
Handles the user acting on this bubble via keyboard navigation by focusing the mutator workspace.
Returns
void