Class: BlockShadowStateChange
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:24
A Blockly event class to revert a block connection's shadow state to the provided state, to be used after attaching a child block that would ordinarily overwrite the connection's shadow state.
Extends
BlockBase
Properties index
| Property | Description |
|---|---|
| blockId | The ID of the block associated with this event. |
| group | An ID for the group of events this block is associated with. |
| inputIndexInParent | The index of the connection in the parent block's list of connections. If null, then the nextConnection will be used instead. |
| isBlank | Whether or not the event was constructed without necessary parameters (to be populated by fromJson). |
| isUiEvent | Whether or not the event is a UI event. |
| recordUndo | Whether this event is undoable or not. |
| shadowState | The intended shadow state of the connection. |
| type | Type of this event. |
| workspaceId | The workspace identifier for this event. |
| EVENT_TYPE | The name of the event type for broadcast and listening purposes. |
Methods index
| Method | Description |
|---|---|
| getEventWorkspace_ | Get workspace the event belongs to. |
| isNull | Does this event record any change of state? |
| run | Run a change event. |
| toJson | Encode the event as JSON. |
| fromJson | Decode the JSON event. |
Constructors
Constructor
new BlockShadowStateChange(
block,
inputIndexInParent,
shadowState
): BlockShadowStateChange;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:51
The constructor for a new BlockShadowStateChange event.
Parameters
| Parameter | Type | Description |
|---|---|---|
block | Block | The parent of the connection to modify. |
inputIndexInParent | number | null | The index of the input associated with the connection to modify, if it is associated with one. Otherwise the nextConnection will be used. |
shadowState | State | The intended shadow state of the connection. |
Returns
BlockShadowStateChange
Overrides
Blockly.Events.BlockBase.constructor
Properties
blockId?
blockId?: string;
The ID of the block associated with this event.
Inherited from
Blockly.Events.BlockBase.blockId
group
group: string;
An ID for the group of events this block is associated with.
Groups define events that should be treated as an single action from the user's perspective, and should be undone together.
Inherited from
Blockly.Events.BlockBase.group
inputIndexInParent
inputIndexInParent: number | null;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:35
The index of the connection in the parent block's list of connections. If null, then the nextConnection will be used instead.
isBlank
isBlank: boolean;
Whether or not the event was constructed without necessary parameters (to be populated by fromJson).
Inherited from
Blockly.Events.BlockBase.isBlank
isUiEvent
isUiEvent: boolean;
Whether or not the event is a UI event.
Inherited from
Blockly.Events.BlockBase.isUiEvent
recordUndo
recordUndo: boolean;
Whether this event is undoable or not.
Inherited from
Blockly.Events.BlockBase.recordUndo
shadowState
shadowState: State;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:40
The intended shadow state of the connection.
type
type: string;
Type of this event.
Inherited from
Blockly.Events.BlockBase.type
workspaceId?
workspaceId?: string;
The workspace identifier for this event.
Inherited from
Blockly.Events.BlockBase.workspaceId
EVENT_TYPE
readonly static EVENT_TYPE: "block_shadow_state_change" = 'block_shadow_state_change';
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:29
The name of the event type for broadcast and listening purposes.
Methods
getEventWorkspace_()
getEventWorkspace_(): Workspace;
Get workspace the event belongs to.
Returns
Workspace
The workspace the event belongs to.
Throws
if workspace is null.
Inherited from
Blockly.Events.BlockBase.getEventWorkspace_
isNull()
isNull(): boolean;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:104
Does this event record any change of state?
Returns
boolean
False if something changed.
Overrides
Blockly.Events.BlockBase.isNull
run()
run(forward): void;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:114
Run a change event.
Parameters
| Parameter | Type | Description |
|---|---|---|
forward | boolean | True if run forward, false if run backward (undo). |
Returns
void
Overrides
Blockly.Events.BlockBase.run
toJson()
toJson(): BlockShadowStateChangeJson;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:69
Encode the event as JSON.
Returns
JSON representation.
Overrides
Blockly.Events.BlockBase.toJson
fromJson()
static fromJson(
json,
workspace,
event?
): BlockShadowStateChange;
Defined in: plugins/shadow-block-converter/src/shadow_block_converter.ts:82
Decode the JSON event.
Parameters
| Parameter | Type | Description |
|---|---|---|
json | BlockShadowStateChangeJson | JSON representation. |
workspace | Workspace | - |
event? | any | - |
Returns
BlockShadowStateChange
Overrides
Blockly.Events.BlockBase.fromJson