Class: WorkspaceSvg
Defined in: packages/blockly/core/workspace_svg.ts:100
Class for a workspace. This is an onscreen area with optional trashcan, scrollbars, bubbles, and dragging.
Extends
Implements
Properties index
| Property | Description |
|---|---|
| SCAN_ANGLE | Angle away from the horizontal to sweep for blocks. Order of execution is generally top to bottom, but a small angle changes the scan to give a bit of a left to right bias (reversed in RTL). Units are in degrees. See: https://tvtropes.org/pmwiki/pmwiki.php/Main/DiagonalBilling |
| id | - |
| options | - |
| RTL | - |
| horizontalLayout | - |
| toolboxPosition | - |
| MAX_UNDO | Maximum number of undo events in stack. 0 turns off undo, Infinity sets it to unlimited. |
| connectionDBList | Set of databases for rapid lookup of connection locations. |
| connectionChecker | - |
| undoStack_ | - |
| redoStack_ | - |
| rendered | The render status of an SVG workspace. Returns false for headless workspaces and true for instances of WorkspaceSvg. |
| scrollX | Current horizontal scrolling offset in pixel units, relative to the workspace origin. |
| scrollY | Current vertical scrolling offset in pixel units, relative to the workspace origin. |
| startScrollX | Horizontal scroll value when scrolling started in pixel units. |
| startScrollY | Vertical scroll value when scrolling started in pixel units. |
| scale | Current scale. |
| trashcan | The workspace's trashcan (if any). |
| scrollbar | This workspace's scrollbars, if they exist. |
| configureContextMenu | Developers may define this function to add custom menu options to the workspace's context menu or edit the workspace-created set of menu options. |
| themeManager_ | - |
| svgGroup_ | - |
| svgBackground_ | - |
| svgBlockCanvas_ | - |
| svgBubbleCanvas_ | - |
| zoomControls_ | - |
Methods index
| Method | Description |
|---|---|
| sortByOrigin | Sorts bounded elements on the workspace by their relative position, top to bottom (with slight LTR or RTL bias). |
| addTypedBlock | Add a block to the list of blocks keyed by type. |
| removeTypedBlock | Remove a block from the list of blocks keyed by type. |
| getBlocksByType | Finds the blocks with the associated type and returns them. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias). |
| remainingCapacity | The number of blocks that may be added to the workspace before reaching the maxBlocks. |
| remainingCapacityOfType | The number of blocks of the given type that may be added to the workspace before reaching the maxInstances allowed for that type. |
| isCapacityAvailable | Check if there is remaining capacity for blocks of the given counts to be created. If the total number of blocks represented by the map is more than the total remaining capacity, it returns false. If a type count is more than the remaining capacity for that type, it returns false. |
| hasBlockLimits | Checks if the workspace has any limits on the maximum number of blocks, or the maximum number of blocks of specific types. |
| undo | Undo or redo the previous action. |
| redo | Redoes the previous action. |
| clearUndo | Clear the undo/redo stacks. |
| addChangeListener | When something in this workspace changes, call a function. Note that there may be a few recent events already on the stack. Thus the new change listener might be called with events that occurred a few milliseconds before the change listener was added. |
| removeChangeListener | Stop listening for this workspace's changes. |
| fireChangeListener | Fire a change event. |
| allInputsFilled | Checks whether all value and statement inputs in the workspace are filled with blocks. |
| getPotentialVariableMap | Return the variable map that contains "potential" variables. These exist in the flyout but not in the workspace. |
| getVariableMap | Return the map of all variables on the workspace. |
| getProcedureMap | Returns the map of all procedures on the workpace. |
| getById | Find the workspace with the specified ID. |
| getAll | Find all workspaces. |
| getVariableMapClass | - |
| isReadOnly | Returns whether or not this workspace is in readonly mode. |
| getMetricsManager | Gets the metrics manager for this workspace. |
| getComponentManager | Gets the component manager for this workspace. |
| getRenderer | Get the block renderer attached to this workspace. |
| getTheme | Get the workspace theme object. |
| setTheme | Set the workspace theme object. If no theme is passed, default to the Classic theme. |
| refreshTheme | Refresh all blocks on the workspace after a theme update. |
| getInverseScreenCTM | Getter for the inverted screen CTM. |
| updateInverseScreenCTM | Mark the inverse screen CTM as dirty. |
| isVisible | Getter for isVisible |
| getSvgGroup | Returns the SVG group for the workspace. |
| setResizeHandlerWrapper | Save resize handler data so we can delete it later in dispose. |
| setInitialAriaContext | Sets Aria labels, roles, etc. for the workspace depending on the type of workspace it is. |
| createDom | Create the workspace DOM elements. |
| dispose | Dispose of this workspace. Unlink from all DOM elements to prevent memory leaks. |
| copyOptionsForFlyout | Creates a new set of options from this workspace's options with just the values that are relevant to a flyout. |
| getFlyout | Getter for the flyout associated with this workspace. This flyout may be owned by either the toolbox or the workspace, depending on toolbox configuration. It will be null if there is no flyout. |
| getToolbox | Getter for the toolbox associated with this workspace, if one exists. |
| resize | Resize and reposition all of the workspace chrome (toolbox, trash, scrollbars etc.) This should be called when something changes that requires recalculating dimensions and positions of the trash, zoom, toolbox, etc. (e.g. window resize). |
| getCanvas | Get the SVG element that forms the drawing surface. |
| getBubbleCanvas | Get the SVG element that forms the bubble surface. |
| getParentSvg | Get the SVG element that contains this workspace. Note: We assume this is only called after the workspace has been injected into the DOM. |
| translate | Translate this workspace to new coordinates. |
| getWidth | Returns the horizontal offset of the workspace. Intended for LTR/RTL compatibility in XML. |
| setVisible | Toggles the visibility of the workspace. Currently only intended for main workspace. |
| render | Render all blocks in workspace. |
| highlightBlock | Highlight or unhighlight a block in the workspace. Block highlighting is often used to visually mark blocks currently being executed. |
| recordDragTargets | Make a list of all the delete areas for this workspace. |
| newBlock | Obtain a newly created block. |
| newComment | Obtain a newly created comment. |
| getDragTarget | Returns the drag target at the given point. |
| startDrag | Start tracking a drag of an object on this workspace. |
| moveDrag | Track a drag of an object on this workspace. |
| isDragging | Returns true iff the user is currently engaged in a drag gesture, or if a keyboard-initated move is in progress. |
| isDraggable | Is this workspace draggable? |
| isMovable | Is this workspace movable? |
| isMovableHorizontally | Is this workspace movable horizontally? |
| isMovableVertically | Is this workspace movable vertically? |
| getBlocksBoundingBox | Calculate the bounding box for the blocks on the workspace. Coordinate system: workspace coordinates. |
| cleanUp | Clean up the workspace by ordering all the blocks in a column such that none overlap. |
| updateToolbox | Modify the block tree on the existing toolbox. |
| markFocused | Mark this workspace as the currently focused main workspace. |
| zoom | Zooms the workspace in or out relative to/centered on the given (x, y) coordinate. |
| zoomCenter | Zooming the blocks centered in the center of view with zooming in or out. |
| zoomToFit | Zoom the blocks to fit in the workspace if possible. |
| scrollCenter | Center the workspace. |
| centerOnBlock | Scroll the workspace to center on the given block. If the block has other blocks stacked below it, the workspace will be centered on the stack, unless blockOnly is true. |
| setScale | Set the workspace's zoom factor. |
| getScale | Get the workspace's zoom factor. |
| getAbsoluteScale | Returns the absolute scale of the workspace. |
| scroll | Scroll the workspace to a specified offset (in pixels), keeping in the workspace bounds. See comment on workspaceSvg.scrollX for more detail on the meaning of these values. |
| getBlockById | Find the block on this workspace with the specified ID. |
| getAllBlocks | Find all blocks in workspace. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias). |
| getTopBlocks | Finds the top-level blocks and returns them. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias). |
| addTopBlock | Adds a block to the list of top blocks. |
| removeTopBlock | Removes a block from the list of top blocks. |
| addTopComment | Adds a comment to the list of top comments. |
| removeTopComment | Removes a comment from the list of top comments. |
| getTopComments | Returns a list of comments on this workspace. |
| getCommentById | Returns the workspace comment with the given ID, if any. |
| getRootWorkspace | Returns the root workspace of this workspace if the workspace has parent(s). |
| addTopBoundedElement | Adds a bounded element to the list of top bounded elements. |
| removeTopBoundedElement | Removes a bounded element from the list of top bounded elements. |
| getTopBoundedElements | Finds the top-level bounded elements and returns them. |
| setResizesEnabled | Update whether this workspace has resizes enabled. If enabled, workspace will resize when appropriate. If disabled, workspace will not resize until re-enabled. Use to avoid resizing during a batch operation, for performance. |
| clear | Dispose of all blocks in workspace, with an optimization to prevent resizes. |
| registerButtonCallback | Register a callback function associated with a given key, for clicks on buttons and labels in the flyout. For instance, a button specified by the XML should be matched by a call to registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction). |
| getButtonCallback | Get the callback function associated with a given key, for clicks on buttons and labels in the flyout. |
| removeButtonCallback | Remove a callback for a click on a button in the flyout. |
| registerToolboxCategoryCallback | Register a callback function associated with a given key, for populating custom toolbox categories in this workspace. See the variable and procedure categories as an example. |
| getToolboxCategoryCallback | Get the callback function associated with a given key, for populating custom toolbox categories in this workspace. |
| removeToolboxCategoryCallback | Remove a callback for a click on a custom category's name in the toolbox. |
| getAudioManager | Get the audio manager for this workspace. |
| getGrid | Get the grid object for this workspace, or null if there is none. |
| hideChaff | Close tooltips, context menus, dropdown selections, etc. |
| hideComponents | Hide any autohideable components (like flyout, trashcan, and any user-registered components). |
| addClass | Adds a CSS class to the workspace. |
| removeClass | Removes a CSS class from the workspace. |
| setIsReadOnly | Sets whether or not this workspace is in readonly mode. |
| getFocusableElement | See IFocusableNode.getFocusableElement. |
| getFocusableTree | See IFocusableNode.getFocusableTree. |
| onNodeFocus | See IFocusableNode.onNodeFocus. |
| onNodeBlur | See IFocusableNode.onNodeBlur. |
| canBeFocused | See IFocusableNode.canBeFocused. |
| getRootFocusableNode | See IFocusableTree.getRootFocusableNode. |
| getRestoredFocusableNode | See IFocusableTree.getRestoredFocusableNode. |
| getWorkspaceFocusTarget | Returns the focusable node representing this workspace as a whole, or null for workspaces without one (flyouts and mutators). |
| getNestedTrees | See IFocusableTree.getNestedTrees. |
| lookUpFocusableNode | See IFocusableTree.lookUpFocusableNode. |
| onTreeFocus | See IFocusableTree.onTreeFocus. |
| onTreeBlur | See IFocusableTree.onTreeBlur. |
| performAction | Handles the user acting on this workspace via keyboard navigation by prompting them to use the arrow keys (instead of Enter) to navigate. |
| getNavigator | Returns an object responsible for coordinating movement of focus between items on this workspace in response to keyboard navigation commands. |
| setNavigator | Sets the Navigator instance used by this workspace. |
Constructors
Constructor
new WorkspaceSvg(options): WorkspaceSvg;
Defined in: packages/blockly/core/workspace_svg.ts:370
Parameters
| Parameter | Type | Description |
|---|---|---|
options | Options | Dictionary of options. |
Returns
WorkspaceSvg
Overrides
Properties
SCAN_ANGLE
static SCAN_ANGLE: number = 3;
Defined in: packages/blockly/core/workspace.ts:49
Angle away from the horizontal to sweep for blocks. Order of execution is generally top to bottom, but a small angle changes the scan to give a bit of a left to right bias (reversed in RTL). Units are in degrees. See: https://tvtropes.org/pmwiki/pmwiki.php/Main/DiagonalBilling
Inherited from
id
id: string;
Defined in: packages/blockly/core/workspace.ts:50
Inherited from
options
options: Options;
Defined in: packages/blockly/core/workspace.ts:51
Inherited from
RTL
RTL: boolean;
Defined in: packages/blockly/core/workspace.ts:52
Inherited from
horizontalLayout
horizontalLayout: boolean;
Defined in: packages/blockly/core/workspace.ts:53
Inherited from
toolboxPosition
toolboxPosition: Position;
Defined in: packages/blockly/core/workspace.ts:54
Inherited from
MAX_UNDO
MAX_UNDO: number = 1024;
Defined in: packages/blockly/core/workspace.ts:97
Maximum number of undo events in stack. 0 turns off undo, Infinity
sets it to unlimited.
Inherited from
connectionDBList
connectionDBList: ConnectionDB[] = [];
Defined in: packages/blockly/core/workspace.ts:100
Set of databases for rapid lookup of connection locations.
Inherited from
connectionChecker
connectionChecker: IConnectionChecker;
Defined in: packages/blockly/core/workspace.ts:101
Inherited from
undoStack_
protected undoStack_: Abstract[] = [];
Defined in: packages/blockly/core/workspace.ts:107
Inherited from
redoStack_
protected redoStack_: Abstract[] = [];
Defined in: packages/blockly/core/workspace.ts:108
Inherited from
rendered
rendered: boolean = true;
Defined in: packages/blockly/core/workspace_svg.ts:115
The render status of an SVG workspace.
Returns false for headless workspaces and true for instances of
WorkspaceSvg.
Overrides
scrollX
scrollX: number = 0;
Defined in: packages/blockly/core/workspace_svg.ts:159
Current horizontal scrolling offset in pixel units, relative to the workspace origin.
It is useful to think about a view, and a canvas moving beneath that view. As the canvas moves right, this value becomes more positive, and the view is now "seeing" the left side of the canvas. As the canvas moves left, this value becomes more negative, and the view is now "seeing" the right side of the canvas.
The confusing thing about this value is that it does not, and must not include the absoluteLeft offset. This is because it is used to calculate the viewLeft value.
The viewLeft is relative to the workspace origin (although in pixel units). The workspace origin is the top-left corner of the workspace (at least when it is enabled). It is shifted from the top-left of the blocklyDiv so as not to be beneath the toolbox.
When the workspace is enabled the viewLeft and workspace origin are at the same X location. As the canvas slides towards the right beneath the view this value (scrollX) becomes more positive, and the viewLeft becomes more negative relative to the workspace origin (imagine the workspace origin as a dot on the canvas sliding to the right as the canvas moves).
So if the scrollX were to include the absoluteLeft this would in a way "unshift" the workspace origin. This means that the viewLeft would be representing the left edge of the blocklyDiv, rather than the left edge of the workspace.
scrollY
scrollY: number = 0;
Defined in: packages/blockly/core/workspace_svg.ts:191
Current vertical scrolling offset in pixel units, relative to the workspace origin.
It is useful to think about a view, and a canvas moving beneath that view. As the canvas moves down, this value becomes more positive, and the view is now "seeing" the upper part of the canvas. As the canvas moves up, this value becomes more negative, and the view is "seeing" the lower part of the canvas.
This confusing thing about this value is that it does not, and must not include the absoluteTop offset. This is because it is used to calculate the viewTop value.
The viewTop is relative to the workspace origin (although in pixel units). The workspace origin is the top-left corner of the workspace (at least when it is enabled). It is shifted from the top-left of the blocklyDiv so as not to be beneath the toolbox.
When the workspace is enabled the viewTop and workspace origin are at the same Y location. As the canvas slides towards the bottom this value (scrollY) becomes more positive, and the viewTop becomes more negative relative to the workspace origin (image in the workspace origin as a dot on the canvas sliding downwards as the canvas moves).
So if the scrollY were to include the absoluteTop this would in a way "unshift" the workspace origin. This means that the viewTop would be representing the top edge of the blocklyDiv, rather than the top edge of the workspace.
startScrollX
startScrollX: number = 0;
Defined in: packages/blockly/core/workspace_svg.ts:194
Horizontal scroll value when scrolling started in pixel units.
startScrollY
startScrollY: number = 0;
Defined in: packages/blockly/core/workspace_svg.ts:197
Vertical scroll value when scrolling started in pixel units.
scale
scale: number = 1;
Defined in: packages/blockly/core/workspace_svg.ts:200
Current scale.
trashcan
trashcan: Trashcan | null = null;
Defined in: packages/blockly/core/workspace_svg.ts:212
The workspace's trashcan (if any).
scrollbar
scrollbar: ScrollbarPair | null = null;
Defined in: packages/blockly/core/workspace_svg.ts:215
This workspace's scrollbars, if they exist.
configureContextMenu
configureContextMenu: ((menuOptions, e) => void) | null = null;
Defined in: packages/blockly/core/workspace_svg.ts:256
Developers may define this function to add custom menu options to the workspace's context menu or edit the workspace-created set of menu options.
Param
options
List of menu options to add to.
Param
e
The right-click event that triggered the context menu.
themeManager_
protected themeManager_: ThemeManager;
Defined in: packages/blockly/core/workspace_svg.ts:307
svgGroup_
svgGroup_: SVGElement;
Defined in: packages/blockly/core/workspace_svg.ts:322
svgBackground_
svgBackground_: SVGElement;
Defined in: packages/blockly/core/workspace_svg.ts:324
svgBlockCanvas_
svgBlockCanvas_: SVGElement;
Defined in: packages/blockly/core/workspace_svg.ts:326
svgBubbleCanvas_
svgBubbleCanvas_: SVGElement;
Defined in: packages/blockly/core/workspace_svg.ts:328
zoomControls_
zoomControls_: ZoomControls | null = null;
Defined in: packages/blockly/core/workspace_svg.ts:329
Accessors
isFlyout
Get Signature
get isFlyout(): boolean;
Defined in: packages/blockly/core/workspace.ts:69
Is this workspace the surface for a flyout?
Returns
boolean
Inherited from
isMutator
Get Signature
get isMutator(): boolean;
Defined in: packages/blockly/core/workspace.ts:81
Is this workspace the surface for a mutator?
Returns
boolean
Inherited from
Methods
sortByOrigin()
protected sortByOrigin(a, b): number;
Defined in: packages/blockly/core/workspace.ts:201
Sorts bounded elements on the workspace by their relative position, top to bottom (with slight LTR or RTL bias).
Parameters
| Parameter | Type | Description |
|---|---|---|
a | IBoundedElement | The first element to sort. |
b | IBoundedElement | The second elment to sort. |
Returns
number
-1, 0 or 1 depending on the sort order.
Inherited from
addTypedBlock()
addTypedBlock(block): void;
Defined in: packages/blockly/core/workspace.ts:250
Add a block to the list of blocks keyed by type.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | Block | Block to add. |
Returns
void
Inherited from
removeTypedBlock()
removeTypedBlock(block): void;
Defined in: packages/blockly/core/workspace.ts:262
Remove a block from the list of blocks keyed by type.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | Block | Block to remove. |
Returns
void
Inherited from
getBlocksByType()
getBlocksByType(type, ordered?): Block[];
Defined in: packages/blockly/core/workspace.ts:277
Finds the blocks with the associated type and returns them. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
type | string | undefined | The type of block to search for. |
ordered | boolean | false | Sort the list if true. |
Returns
Block[]
The blocks of the given type.
Inherited from
remainingCapacity()
remainingCapacity(): number;
Defined in: packages/blockly/core/workspace.ts:454
The number of blocks that may be added to the workspace before reaching the maxBlocks.
Returns
number
Number of blocks left.
Inherited from
remainingCapacityOfType()
remainingCapacityOfType(type): number;
Defined in: packages/blockly/core/workspace.ts:469
The number of blocks of the given type that may be added to the workspace before reaching the maxInstances allowed for that type.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | string | Type of block to return capacity for. |
Returns
number
Number of blocks of type left.
Inherited from
Workspace.remainingCapacityOfType
isCapacityAvailable()
isCapacityAvailable(typeCountsMap): boolean;
Defined in: packages/blockly/core/workspace.ts:492
Check if there is remaining capacity for blocks of the given counts to be created. If the total number of blocks represented by the map is more than the total remaining capacity, it returns false. If a type count is more than the remaining capacity for that type, it returns false.
Parameters
| Parameter | Type | Description |
|---|---|---|
typeCountsMap | { [key: string]: number; } | A map of types to counts (usually representing blocks to be created). |
Returns
boolean
True if there is capacity for the given map, false otherwise.
Inherited from
hasBlockLimits()
hasBlockLimits(): boolean;
Defined in: packages/blockly/core/workspace.ts:515
Checks if the workspace has any limits on the maximum number of blocks, or the maximum number of blocks of specific types.
Returns
boolean
True if it has block limits, false otherwise.
Inherited from
undo()
undo(redo?): void;
Defined in: packages/blockly/core/workspace.ts:544
Undo or redo the previous action.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
redo | boolean | false | False if undo, true if redo. |
Returns
void
Inherited from
redo()
redo(): void;
Defined in: packages/blockly/core/workspace.ts:581
Redoes the previous action.
Returns
void
Inherited from
clearUndo()
clearUndo(): void;
Defined in: packages/blockly/core/workspace.ts:586
Clear the undo/redo stacks.
Returns
void
Inherited from
addChangeListener()
addChangeListener(func): (e) => void;
Defined in: packages/blockly/core/workspace.ts:602
When something in this workspace changes, call a function. Note that there may be a few recent events already on the stack. Thus the new change listener might be called with events that occurred a few milliseconds before the change listener was added.
Parameters
| Parameter | Type | Description |
|---|---|---|
func | (e) => void | Function to call. |
Returns
Obsolete return value, ignore.
(e) => void
Inherited from
removeChangeListener()
removeChangeListener(func): void;
Defined in: packages/blockly/core/workspace.ts:612
Stop listening for this workspace's changes.
Parameters
| Parameter | Type | Description |
|---|---|---|
func | (e) => void | Function to stop calling. |
Returns
void
Inherited from
Workspace.removeChangeListener
fireChangeListener()
fireChangeListener(event): void;
Defined in: packages/blockly/core/workspace.ts:621
Fire a change event.
Parameters
| Parameter | Type | Description |
|---|---|---|
event | Abstract | Event to fire. |
Returns
void
Inherited from
allInputsFilled()
allInputsFilled(opt_shadowBlocksAreFilled?): boolean;
Defined in: packages/blockly/core/workspace.ts:684
Checks whether all value and statement inputs in the workspace are filled with blocks.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt_shadowBlocksAreFilled? | boolean | An optional argument controlling whether shadow blocks are counted as filled. Defaults to true. |
Returns
boolean
True if all inputs are filled, false otherwise.
Inherited from
getPotentialVariableMap()
getPotentialVariableMap():
| IVariableMap<IVariableModel<IVariableState>>
| null;
Defined in: packages/blockly/core/workspace.ts:701
Return the variable map that contains "potential" variables. These exist in the flyout but not in the workspace.
Returns
| IVariableMap<IVariableModel<IVariableState>>
| null
The potential variable map.
Inherited from
Workspace.getPotentialVariableMap
getVariableMap()
getVariableMap(): IVariableMap<IVariableModel<IVariableState>>;
Defined in: packages/blockly/core/workspace.ts:722
Return the map of all variables on the workspace.
Returns
IVariableMap<IVariableModel<IVariableState>>
The variable map.
Inherited from
getProcedureMap()
getProcedureMap(): IProcedureMap;
Defined in: packages/blockly/core/workspace.ts:737
Returns the map of all procedures on the workpace.
Returns
Inherited from
getById()
static getById(id): Workspace | null;
Defined in: packages/blockly/core/workspace.ts:769
Find the workspace with the specified ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | ID of workspace to find. |
Returns
Workspace | null
The sought after workspace or null if not found.
Inherited from
getAll()
static getAll(): Workspace[];
Defined in: packages/blockly/core/workspace.ts:778
Find all workspaces.
Returns
Array of workspaces.
Inherited from
getVariableMapClass()
protected getVariableMapClass(): (...p1) => IVariableMap<IVariableModel<IVariableState>>;
Defined in: packages/blockly/core/workspace.ts:782
Returns
(...p1) => IVariableMap<IVariableModel<IVariableState>>
Inherited from
isReadOnly()
isReadOnly(): boolean;
Defined in: packages/blockly/core/workspace.ts:801
Returns whether or not this workspace is in readonly mode.
Returns
boolean
True if the workspace is readonly, otherwise false.
Inherited from
getMetricsManager()
getMetricsManager(): IMetricsManager;
Defined in: packages/blockly/core/workspace_svg.ts:454
Gets the metrics manager for this workspace.
Returns
The metrics manager.
getComponentManager()
getComponentManager(): ComponentManager;
Defined in: packages/blockly/core/workspace_svg.ts:474
Gets the component manager for this workspace.
Returns
The component manager.
getRenderer()
getRenderer(): Renderer;
Defined in: packages/blockly/core/workspace_svg.ts:483
Get the block renderer attached to this workspace.
Returns
The renderer attached to this workspace.
getTheme()
getTheme(): Theme;
Defined in: packages/blockly/core/workspace_svg.ts:502
Get the workspace theme object.
Returns
The workspace theme object.
setTheme()
setTheme(theme): void;
Defined in: packages/blockly/core/workspace_svg.ts:512
Set the workspace theme object.
If no theme is passed, default to the Classic theme.
Parameters
| Parameter | Type | Description |
|---|---|---|
theme | Theme | The workspace theme object. |
Returns
void
refreshTheme()
refreshTheme(): void;
Defined in: packages/blockly/core/workspace_svg.ts:522
Refresh all blocks on the workspace after a theme update.
Returns
void
getInverseScreenCTM()
getInverseScreenCTM(): DOMMatrix | null;
Defined in: packages/blockly/core/workspace_svg.ts:575
Getter for the inverted screen CTM.
Returns
DOMMatrix | null
The matrix to use in mouseToSvg
updateInverseScreenCTM()
updateInverseScreenCTM(): void;
Defined in: packages/blockly/core/workspace_svg.ts:590
Mark the inverse screen CTM as dirty.
Returns
void
isVisible()
isVisible(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:600
Getter for isVisible
Returns
boolean
Whether the workspace is visible.
False if the workspace has been hidden by calling setVisible(false).
getSvgGroup()
getSvgGroup(): Element;
Defined in: packages/blockly/core/workspace_svg.ts:701
Returns the SVG group for the workspace.
Returns
Element
The SVG group for the workspace.
setResizeHandlerWrapper()
setResizeHandlerWrapper(handler): void;
Defined in: packages/blockly/core/workspace_svg.ts:720
Save resize handler data so we can delete it later in dispose.
Parameters
| Parameter | Type | Description |
|---|---|---|
handler | Data | Data that can be passed to eventHandling.unbind. |
Returns
void
setInitialAriaContext()
setInitialAriaContext(): void;
Defined in: packages/blockly/core/workspace_svg.ts:727
Sets Aria labels, roles, etc. for the workspace depending on the type of workspace it is.
Returns
void
createDom()
createDom(opt_backgroundClass?, injectionDiv?): Element;
Defined in: packages/blockly/core/workspace_svg.ts:796
Create the workspace DOM elements.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt_backgroundClass? | string | Either 'blocklyMainBackground' or 'blocklyMutatorBackground'. |
injectionDiv? | HTMLElement | - |
Returns
Element
The workspace's SVG group.
dispose()
dispose(): void;
Defined in: packages/blockly/core/workspace_svg.ts:929
Dispose of this workspace. Unlink from all DOM elements to prevent memory leaks.
Returns
void
Overrides
copyOptionsForFlyout()
copyOptionsForFlyout(): Options;
Defined in: packages/blockly/core/workspace_svg.ts:1050
Creates a new set of options from this workspace's options with just the values that are relevant to a flyout.
Returns
A subset of this workspace's options.
getFlyout()
getFlyout(opt_own?): IFlyout | null;
Defined in: packages/blockly/core/workspace_svg.ts:1108
Getter for the flyout associated with this workspace. This flyout may be owned by either the toolbox or the workspace, depending on toolbox configuration. It will be null if there is no flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
opt_own? | boolean | Whether to only return the workspace's own flyout. |
Returns
IFlyout | null
The flyout on this workspace.
getToolbox()
getToolbox(): IToolbox | null;
Defined in: packages/blockly/core/workspace_svg.ts:1123
Getter for the toolbox associated with this workspace, if one exists.
Returns
IToolbox | null
The toolbox on this workspace.
resize()
resize(): void;
Defined in: packages/blockly/core/workspace_svg.ts:1160
Resize and reposition all of the workspace chrome (toolbox, trash, scrollbars etc.) This should be called when something changes that requires recalculating dimensions and positions of the trash, zoom, toolbox, etc. (e.g. window resize).
Returns
void
getCanvas()
getCanvas(): SVGGElement;
Defined in: packages/blockly/core/workspace_svg.ts:1236
Get the SVG element that forms the drawing surface.
Returns
SVGGElement
SVG group element.
getBubbleCanvas()
getBubbleCanvas(): SVGGElement;
Defined in: packages/blockly/core/workspace_svg.ts:1269
Get the SVG element that forms the bubble surface.
Returns
SVGGElement
SVG group element.
getParentSvg()
getParentSvg(): SVGSVGElement;
Defined in: packages/blockly/core/workspace_svg.ts:1280
Get the SVG element that contains this workspace. Note: We assume this is only called after the workspace has been injected into the DOM.
Returns
SVGSVGElement
SVG element.
translate()
translate(x, y): void;
Defined in: packages/blockly/core/workspace_svg.ts:1337
Translate this workspace to new coordinates.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | Horizontal translation, in pixel units relative to the top left of the Blockly div. |
y | number | Vertical translation, in pixel units relative to the top left of the Blockly div. |
Returns
void
getWidth()
getWidth(): number;
Defined in: packages/blockly/core/workspace_svg.ts:1349
Returns the horizontal offset of the workspace. Intended for LTR/RTL compatibility in XML.
Returns
number
Width.
Overrides
setVisible()
setVisible(isVisible): void;
Defined in: packages/blockly/core/workspace_svg.ts:1360
Toggles the visibility of the workspace. Currently only intended for main workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
isVisible | boolean | True if workspace should be visible. |
Returns
void
render()
render(): void;
Defined in: packages/blockly/core/workspace_svg.ts:1391
Render all blocks in workspace.
Returns
void
highlightBlock()
highlightBlock(id, opt_state?): void;
Defined in: packages/blockly/core/workspace_svg.ts:1415
Highlight or unhighlight a block in the workspace. Block highlighting is often used to visually mark blocks currently being executed.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | null | ID of block to highlight/unhighlight, or null for no block (used to unhighlight all blocks). |
opt_state? | boolean | If undefined, highlight specified block and automatically unhighlight all others. If true or false, manually highlight/unhighlight the specified block. |
Returns
void
recordDragTargets()
recordDragTargets(): void;
Defined in: packages/blockly/core/workspace_svg.ts:1467
Make a list of all the delete areas for this workspace.
Returns
void
newBlock()
newBlock(prototypeName, opt_id?): BlockSvg;
Defined in: packages/blockly/core/workspace_svg.ts:1495
Obtain a newly created block.
Parameters
| Parameter | Type | Description |
|---|---|---|
prototypeName | string | Name of the language object containing type-specific functions for this block. |
opt_id? | string | Optional ID. Use this ID if provided, otherwise create a new ID. |
Returns
The created block.
Overrides
newComment()
newComment(id?): WorkspaceComment;
Defined in: packages/blockly/core/workspace_svg.ts:1509
Obtain a newly created comment.
Parameters
| Parameter | Type | Description |
|---|---|---|
id? | string | Optional ID. Use this ID if provided, otherwise create a new ID. |
Returns
The created comment.
Overrides
getDragTarget()
getDragTarget(point): IDragTarget | null;
Defined in: packages/blockly/core/workspace_svg.ts:1523
Returns the drag target at the given point.
Parameters
| Parameter | Type | Description |
|---|---|---|
point | | Coordinate | PointerEvent | A pointer event, or a point in client/viewport coordinates. |
Returns
IDragTarget | null
Null if not over a drag target, or the drag target at that point.
startDrag()
startDrag(e, xy): void;
Defined in: packages/blockly/core/workspace_svg.ts:1554
Start tracking a drag of an object on this workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | PointerEvent | Pointer down event. |
xy | Coordinate | Starting location of object. |
Returns
void
moveDrag()
moveDrag(e): Coordinate;
Defined in: packages/blockly/core/workspace_svg.ts:1564
Track a drag of an object on this workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
e | PointerEvent | Pointer move event. |
Returns
New location of object.
isDragging()
isDragging(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:1582
Returns true iff the user is currently engaged in a drag gesture, or if a keyboard-initated move is in progress.
Dragging gestures normally entail moving a block or other item on the workspace, or scrolling the flyout/workspace.
Keyboard-initated movements are implemnted using the dragging infrastructure and are intended to emulate (a subset of) drag gestures and so should typically be treated as if they were a gesture-based drag.
Returns
boolean
True iff a drag gesture or keyboard move is in porgress.
isDraggable()
isDraggable(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:1594
Is this workspace draggable?
Returns
boolean
True if this workspace may be dragged.
isMovable()
isMovable(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:1609
Is this workspace movable?
This means the user can reposition the X Y coordinates of the workspace through input. This can be through scrollbars, scroll wheel, dragging, or through zooming with the scroll wheel or pinch (since the zoom is centered on the mouse position). This does not include zooming with the zoom controls since the X Y coordinates are decided programmatically.
Returns
boolean
True if the workspace is movable, false otherwise.
isMovableHorizontally()
isMovableHorizontally(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:1624
Is this workspace movable horizontally?
Returns
boolean
True if the workspace is movable horizontally, false otherwise.
isMovableVertically()
isMovableVertically(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:1638
Is this workspace movable vertically?
Returns
boolean
True if the workspace is movable vertically, false otherwise.
getBlocksBoundingBox()
getBlocksBoundingBox(): Rect;
Defined in: packages/blockly/core/workspace_svg.ts:1712
Calculate the bounding box for the blocks on the workspace. Coordinate system: workspace coordinates.
Returns
Contains the position and size of the bounding box containing the blocks on the workspace.
cleanUp()
cleanUp(): void;
Defined in: packages/blockly/core/workspace_svg.ts:1749
Clean up the workspace by ordering all the blocks in a column such that none overlap.
Returns
void
updateToolbox()
updateToolbox(toolboxDef): void;
Defined in: packages/blockly/core/workspace_svg.ts:1843
Modify the block tree on the existing toolbox.
Parameters
| Parameter | Type | Description |
|---|---|---|
toolboxDef | | ToolboxDefinition | null | DOM tree of toolbox contents, string of toolbox contents, or JSON representing toolbox definition. |
Returns
void
markFocused()
markFocused(): void;
Defined in: packages/blockly/core/workspace_svg.ts:1872
Mark this workspace as the currently focused main workspace.
Returns
void
zoom()
zoom(
x,
y,
amount
): void;
Defined in: packages/blockly/core/workspace_svg.ts:1897
Zooms the workspace in or out relative to/centered on the given (x, y) coordinate.
Parameters
| Parameter | Type | Description |
|---|---|---|
x | number | X coordinate of center, in pixel units relative to the top-left corner of the parentSVG. |
y | number | Y coordinate of center, in pixel units relative to the top-left corner of the parentSVG. |
amount | number | Amount of zooming. The formula for the new scale is newScale = currentScale * (scaleSpeed^amount). scaleSpeed is set in the workspace options. Negative amount values zoom out, and positive amount values zoom in. |
Returns
void
zoomCenter()
zoomCenter(type): void;
Defined in: packages/blockly/core/workspace_svg.ts:1944
Zooming the blocks centered in the center of view with zooming in or out.
Parameters
| Parameter | Type | Description |
|---|---|---|
type | number | Type of zooming (-1 zooming out and 1 zooming in). |
Returns
void
zoomToFit()
zoomToFit(): void;
Defined in: packages/blockly/core/workspace_svg.ts:1964
Zoom the blocks to fit in the workspace if possible.
Returns
void
scrollCenter()
scrollCenter(): void;
Defined in: packages/blockly/core/workspace_svg.ts:2034
Center the workspace.
Returns
void
centerOnBlock()
centerOnBlock(id, blockOnly?): void;
Defined in: packages/blockly/core/workspace_svg.ts:2061
Scroll the workspace to center on the given block. If the block has other blocks stacked below it, the workspace will be centered on the stack, unless blockOnly is true.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | null | ID of block center on. |
blockOnly? | boolean | True to center only on the block itself, not its stack. |
Returns
void
setScale()
setScale(newScale): void;
Defined in: packages/blockly/core/workspace_svg.ts:2120
Set the workspace's zoom factor.
Parameters
| Parameter | Type | Description |
|---|---|---|
newScale | number | Zoom factor. Units: (pixels / workspaceUnit). |
Returns
void
getScale()
getScale(): number;
Defined in: packages/blockly/core/workspace_svg.ts:2173
Get the workspace's zoom factor.
Returns
number
The workspace zoom factor. Units: (pixels / workspaceUnit).
getAbsoluteScale()
getAbsoluteScale(): number;
Defined in: packages/blockly/core/workspace_svg.ts:2192
Returns the absolute scale of the workspace.
Workspace scaling is multiplicative; if a workspace B (e.g. a mutator editor) with scale Y is nested within a root workspace A with scale X, workspace B's effective scale is X * Y, because, as a child of A, it is already transformed by A's scaling factor, and then further transforms itself by its own scaling factor. Normally this Just Works, but for global elements (e.g. field editors) that are visually associated with a particular workspace but live at the top level of the DOM rather than being a child of their associated workspace, the absolute/effective scale may be needed to render appropriately.
Returns
number
The absolute/effective scale of the given workspace.
scroll()
scroll(
x,
y,
shouldHidePopups?
): void;
Defined in: packages/blockly/core/workspace_svg.ts:2241
Scroll the workspace to a specified offset (in pixels), keeping in the workspace bounds. See comment on workspaceSvg.scrollX for more detail on the meaning of these values.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
x | number | undefined | Target X to scroll to. |
y | number | undefined | Target Y to scroll to. |
shouldHidePopups | boolean | true | Whether to hide popups. Defaults to true. |
Returns
void
getBlockById()
getBlockById(id): BlockSvg | null;
Defined in: packages/blockly/core/workspace_svg.ts:2293
Find the block on this workspace with the specified ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | ID of block to find. |
Returns
BlockSvg | null
The sought after block, or null if not found.
Overrides
getAllBlocks()
getAllBlocks(ordered?): BlockSvg[];
Defined in: packages/blockly/core/workspace_svg.ts:2304
Find all blocks in workspace. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
ordered | boolean | false | Sort the list if true. |
Returns
BlockSvg[]
Array of blocks.
Overrides
getTopBlocks()
getTopBlocks(ordered?): BlockSvg[];
Defined in: packages/blockly/core/workspace_svg.ts:2315
Finds the top-level blocks and returns them. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
ordered | boolean | false | Sort the list if true. |
Returns
BlockSvg[]
The top-level block objects.
Overrides
addTopBlock()
addTopBlock(block): void;
Defined in: packages/blockly/core/workspace_svg.ts:2324
Adds a block to the list of top blocks.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | Block | Block to add. |
Returns
void
Overrides
removeTopBlock()
removeTopBlock(block): void;
Defined in: packages/blockly/core/workspace_svg.ts:2334
Removes a block from the list of top blocks.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | Block | Block to remove. |
Returns
void
Overrides
addTopComment()
addTopComment(comment): void;
Defined in: packages/blockly/core/workspace_svg.ts:2344
Adds a comment to the list of top comments.
Parameters
| Parameter | Type | Description |
|---|---|---|
comment | RenderedWorkspaceComment | comment to add. |
Returns
void
Overrides
Workspace.addTopComment
removeTopComment()
removeTopComment(comment): void;
Defined in: packages/blockly/core/workspace_svg.ts:2354
Removes a comment from the list of top comments.
Parameters
| Parameter | Type | Description |
|---|---|---|
comment | RenderedWorkspaceComment | comment to remove. |
Returns
void
Overrides
Workspace.removeTopComment
getTopComments()
getTopComments(ordered?): RenderedWorkspaceComment[];
Defined in: packages/blockly/core/workspace_svg.ts:2365
Returns a list of comments on this workspace.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
ordered | boolean | false | If true, sorts the comments based on their position. |
Returns
A list of workspace comments.
Overrides
Workspace.getTopComments
getCommentById()
getCommentById(id):
| RenderedWorkspaceComment
| null;
Defined in: packages/blockly/core/workspace_svg.ts:2375
Returns the workspace comment with the given ID, if any.
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the comment to retrieve. |
Returns
| RenderedWorkspaceComment
| null
The workspace comment with the given ID, or null.
Overrides
getRootWorkspace()
getRootWorkspace(): WorkspaceSvg | null;
Defined in: packages/blockly/core/workspace_svg.ts:2379
Returns the root workspace of this workspace if the workspace has parent(s).
E.g. workspaces in flyouts and mini workspace bubbles have parent workspaces.
Returns
WorkspaceSvg | null
Overrides
addTopBoundedElement()
addTopBoundedElement(element): void;
Defined in: packages/blockly/core/workspace_svg.ts:2388
Adds a bounded element to the list of top bounded elements.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | IBoundedElement | Bounded element to add. |
Returns
void
removeTopBoundedElement()
removeTopBoundedElement(element): void;
Defined in: packages/blockly/core/workspace_svg.ts:2397
Removes a bounded element from the list of top bounded elements.
Parameters
| Parameter | Type | Description |
|---|---|---|
element | IBoundedElement | Bounded element to remove. |
Returns
void
getTopBoundedElements()
getTopBoundedElements(ordered?): IBoundedElement[];
Defined in: packages/blockly/core/workspace_svg.ts:2406
Finds the top-level bounded elements and returns them.
Parameters
| Parameter | Type | Default value |
|---|---|---|
ordered | boolean | false |
Returns
The top-level bounded elements.
setResizesEnabled()
setResizesEnabled(enabled): void;
Defined in: packages/blockly/core/workspace_svg.ts:2425
Update whether this workspace has resizes enabled. If enabled, workspace will resize when appropriate. If disabled, workspace will not resize until re-enabled. Use to avoid resizing during a batch operation, for performance.
Parameters
| Parameter | Type | Description |
|---|---|---|
enabled | boolean | Whether resizes should be enabled. |
Returns
void
clear()
clear(): void;
Defined in: packages/blockly/core/workspace_svg.ts:2438
Dispose of all blocks in workspace, with an optimization to prevent resizes.
Returns
void
Overrides
registerButtonCallback()
registerButtonCallback(key, func): void;
Defined in: packages/blockly/core/workspace_svg.ts:2456
Register a callback function associated with a given key, for clicks on buttons and labels in the flyout. For instance, a button specified by the XML should be matched by a call to registerButtonCallback("CREATE_VARIABLE", yourCallbackFunction).
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name to use to look up this function. |
func | (p1) => void | The function to call when the given button is clicked. |
Returns
void
getButtonCallback()
getButtonCallback(key): ((p1) => void) | null;
Defined in: packages/blockly/core/workspace_svg.ts:2471
Get the callback function associated with a given key, for clicks on buttons and labels in the flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name to use to look up the function. |
Returns
((p1) => void) | null
The function corresponding to the given key for this workspace; null if no callback is registered.
removeButtonCallback()
removeButtonCallback(key): void;
Defined in: packages/blockly/core/workspace_svg.ts:2480
Remove a callback for a click on a button in the flyout.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name associated with the callback function. |
Returns
void
registerToolboxCategoryCallback()
registerToolboxCategoryCallback(key, func): void;
Defined in: packages/blockly/core/workspace_svg.ts:2492
Register a callback function associated with a given key, for populating custom toolbox categories in this workspace. See the variable and procedure categories as an example.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name to use to look up this function. |
func | (p1) => FlyoutDefinition | The function to call when the given toolbox category is opened. |
Returns
void
getToolboxCategoryCallback()
getToolboxCategoryCallback(key):
| ((p1) => FlyoutDefinition)
| null;
Defined in: packages/blockly/core/workspace_svg.ts:2510
Get the callback function associated with a given key, for populating custom toolbox categories in this workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name to use to look up the function. |
Returns
| ((p1) => FlyoutDefinition)
| null
The function corresponding to the given key for this workspace, or null if no function is registered.
removeToolboxCategoryCallback()
removeToolboxCategoryCallback(key): void;
Defined in: packages/blockly/core/workspace_svg.ts:2521
Remove a callback for a click on a custom category's name in the toolbox.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | The name associated with the callback function. |
Returns
void
getAudioManager()
getAudioManager(): WorkspaceAudio;
Defined in: packages/blockly/core/workspace_svg.ts:2594
Get the audio manager for this workspace.
Returns
The audio manager for this workspace.
getGrid()
getGrid(): Grid | null;
Defined in: packages/blockly/core/workspace_svg.ts:2603
Get the grid object for this workspace, or null if there is none.
Returns
Grid | null
The grid object for this workspace.
hideChaff()
hideChaff(onlyClosePopups?): void;
Defined in: packages/blockly/core/workspace_svg.ts:2613
Close tooltips, context menus, dropdown selections, etc.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
onlyClosePopups | boolean | false | Whether only popups should be closed. Defaults to false. |
Returns
void
hideComponents()
hideComponents(onlyClosePopups?): void;
Defined in: packages/blockly/core/workspace_svg.ts:2628
Hide any autohideable components (like flyout, trashcan, and any user-registered components).
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
onlyClosePopups | boolean | false | Whether only popups should be closed. Defaults to false. |
Returns
void
addClass()
addClass(className): void;
Defined in: packages/blockly/core/workspace_svg.ts:2675
Adds a CSS class to the workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
className | string | Name of class to add. |
Returns
void
removeClass()
removeClass(className): void;
Defined in: packages/blockly/core/workspace_svg.ts:2686
Removes a CSS class from the workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
className | string | Name of class to remove. |
Returns
void
setIsReadOnly()
setIsReadOnly(readOnly): void;
Defined in: packages/blockly/core/workspace_svg.ts:2692
Sets whether or not this workspace is in readonly mode.
Parameters
| Parameter | Type | Description |
|---|---|---|
readOnly | boolean | True to make the workspace readonly, otherwise false. |
Returns
void
Overrides
getFocusableElement()
getFocusableElement(): HTMLElement | SVGElement;
Defined in: packages/blockly/core/workspace_svg.ts:2780
See IFocusableNode.getFocusableElement.
Returns
HTMLElement | SVGElement
Implementation of
IFocusableNode.getFocusableElement
getFocusableTree()
getFocusableTree(): IFocusableTree;
Defined in: packages/blockly/core/workspace_svg.ts:2785
See IFocusableNode.getFocusableTree.
Returns
Implementation of
IFocusableNode.getFocusableTree
onNodeFocus()
onNodeFocus(): void;
Defined in: packages/blockly/core/workspace_svg.ts:2790
See IFocusableNode.onNodeFocus.
Returns
void
Implementation of
onNodeBlur()
onNodeBlur(): void;
Defined in: packages/blockly/core/workspace_svg.ts:2826
See IFocusableNode.onNodeBlur.
Returns
void
Implementation of
canBeFocused()
canBeFocused(): boolean;
Defined in: packages/blockly/core/workspace_svg.ts:2829
See IFocusableNode.canBeFocused.
Returns
boolean
Implementation of
getRootFocusableNode()
getRootFocusableNode(): IFocusableNode;
Defined in: packages/blockly/core/workspace_svg.ts:2834
See IFocusableTree.getRootFocusableNode.
Returns
Implementation of
IFocusableTree.getRootFocusableNode
getRestoredFocusableNode()
getRestoredFocusableNode(previousNode): IFocusableNode | null;
Defined in: packages/blockly/core/workspace_svg.ts:2839
See IFocusableTree.getRestoredFocusableNode.
Parameters
| Parameter | Type |
|---|---|
previousNode | IFocusableNode | null |
Returns
IFocusableNode | null
Implementation of
IFocusableTree.getRestoredFocusableNode
getWorkspaceFocusTarget()
getWorkspaceFocusTarget(): WorkspaceFocusTarget | null;
Defined in: packages/blockly/core/workspace_svg.ts:2876
Returns the focusable node representing this workspace as a whole, or null for workspaces without one (flyouts and mutators).
Focus lands here when the workspace itself is focused (e.g. via the focus workspace shortcut) rather than on any of its contents.
Returns
WorkspaceFocusTarget | null
This workspace's focus target node, if any.
getNestedTrees()
getNestedTrees(): IFocusableTree[];
Defined in: packages/blockly/core/workspace_svg.ts:2881
See IFocusableTree.getNestedTrees.
Returns
Implementation of
lookUpFocusableNode()
lookUpFocusableNode(id): IFocusableNode | null;
Defined in: packages/blockly/core/workspace_svg.ts:2917
See IFocusableTree.lookUpFocusableNode.
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
IFocusableNode | null
Implementation of
IFocusableTree.lookUpFocusableNode
onTreeFocus()
onTreeFocus(_node, _previousTree): void;
Defined in: packages/blockly/core/workspace_svg.ts:3041
See IFocusableTree.onTreeFocus.
Parameters
| Parameter | Type |
|---|---|
_node | IFocusableNode |
_previousTree | IFocusableTree | null |
Returns
void
Implementation of
onTreeBlur()
onTreeBlur(nextTree): void;
Defined in: packages/blockly/core/workspace_svg.ts:3051
See IFocusableTree.onTreeBlur.
Parameters
| Parameter | Type |
|---|---|
nextTree | IFocusableTree | null |
Returns
void
Implementation of
performAction()
performAction(): void;
Defined in: packages/blockly/core/workspace_svg.ts:3079
Handles the user acting on this workspace via keyboard navigation by prompting them to use the arrow keys (instead of Enter) to navigate.
Returns
void
Implementation of
getNavigator()
getNavigator(): Navigator;
Defined in: packages/blockly/core/workspace_svg.ts:3089
Returns an object responsible for coordinating movement of focus between items on this workspace in response to keyboard navigation commands.
Returns
This workspace's Navigator instance.
Implementation of
setNavigator()
setNavigator(newNavigator): void;
Defined in: packages/blockly/core/workspace_svg.ts:3099
Sets the Navigator instance used by this workspace.
Parameters
| Parameter | Type | Description |
|---|---|---|
newNavigator | Navigator | A Navigator object to coordinate movement between elements on the workspace. |
Returns
void