LineCursor class
Class for a line cursor.
Signature:
export declare class LineCursor extends Marker
Extends: Marker
Constructors
Constructor | Modifiers | Description |
---|---|---|
(constructor)(workspace) | Constructs a new instance of the LineCursor class |
Properties
Property | Modifiers | Type | Description |
---|---|---|---|
type | string | ||
workspace |
|
WorkspaceSvg |
Methods
Method | Modifiers | Description |
---|---|---|
atEndOfLine() | Returns true iff the node to which we would navigate if in() were called is the same as the node to which we would navigate if next() were called - in effect, if the LineCursor is at the end of the 'current line' of the program. | |
getCurNode() | Get the current location of the cursor. Overrides normal Marker getCurNode to update the current node from the selected block. This typically happens via the selection listener but that is not called immediately when |
|
getFirstNode() | Get the first navigable node on the workspace, or null if none exist. | |
getLastNode() | Get the last navigable node on the workspace, or null if none exist. | |
getNextNode(node, isValid, loop) | Get the next node in the AST, optionally allowing for loopback. | |
getPreviousNode(node, isValid, loop) | Get the previous node in the AST, optionally allowing for loopback. | |
in() | Moves the cursor to the next input connection or field in the pre order traversal. | |
next() | Moves the cursor to the next previous connection, next connection or block in the pre order traversal. Finds the next node in the pre order traversal. | |
out() | Moves the cursor to the previous input connection or field in the pre order traversal. | |
postDelete() | Move the cursor to the first valid location in this.potentialNodes, following a block deletion. | |
preDelete(deletedBlock) | Prepare for the deletion of a block by making a list of nodes we could move the cursor to afterwards and save it to this.potentialNodes. After the deletion has occurred, call postDelete to move it to the first valid node on that list. The locations to try (in order of preference) are: - The current location. - The connection to which the deleted block is attached. - The block connected to the next connection of the deleted block. - The parent block of the deleted block. - A location on the workspace beneath the deleted block. N.B.: When block is deleted, all of the blocks conneccted to that block's inputs are also deleted, but not blocks connected to its next connection. |
|
prev() | Moves the cursor to the previous next connection or previous connection in the pre order traversal. | |
setCurNode(newNode) | Set the location of the cursor and draw it. Overrides normal Marker setCurNode logic to call this.drawMarker() instead of this.drawer.draw() directly. |