Class: CommentMove
Defined in: packages/blockly/core/events/events_comment_move.ts:24
Notifies listeners that a workspace comment has moved.
Extends
Properties index
| Property | Description |
|---|---|
| workspaceId | The workspace identifier for this event. |
| group | An ID for the group of events this block is associated with. |
| recordUndo | Whether this event is undoable or not. |
| isUiEvent | Whether or not the event is a UI event. |
| isBlank | Whether or not the event was constructed without necessary parameters (to be populated by fromJson). |
| commentId | The ID of the comment that this event references. |
| type | Type of this event. |
| comment_ | The comment that is being moved. |
| oldCoordinate_ | The location of the comment before the move, in workspace coordinates. |
| newCoordinate_ | The location of the comment after the move, in workspace coordinates. |
| reason | An explanation of what this move is for. Known values include: 'drag' -- A drag operation completed. 'snap' -- Comment got shifted to line up with the grid. 'inbounds' -- Block got pushed back into a non-scrolling workspace. 'create' -- Block created via deserialization. 'cleanup' -- Workspace aligned top-level blocks. Event merging may create multiple reasons: ['drag', 'inbounds', 'snap']. |
Methods index
| Method | Description |
|---|---|
| getEventWorkspace_ | Get workspace the event belongs to. |
| CommentCreateDeleteHelper | Helper function for Comment[Create |
| recordNew | Record the comment's new location. Called after the move. Can only be called once. |
| setReason | Sets the reason for a move event. |
| setOldCoordinate | Override the location before the move. Use this if you don't create the event until the end of the move, but you know the original location. |
| toJson | Encode the event as JSON. |
| isNull | Does this event record any change of state? |
| run | Run a move event. |
Constructors
Constructor
new CommentMove(opt_comment?): CommentMove;
Defined in: packages/blockly/core/events/events_comment_move.ts:52
Parameters
| Parameter | Type | Description |
|---|---|---|
opt_comment? | WorkspaceComment | The comment that is being moved. Undefined for a blank event. |
Returns
CommentMove
Overrides
Properties
workspaceId?
optional workspaceId?: string = undefined;
Defined in: packages/blockly/core/events/events_abstract.ts:30
The workspace identifier for this event.
Inherited from
group
group: string;
Defined in: packages/blockly/core/events/events_abstract.ts:38
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
recordUndo
recordUndo: boolean;
Defined in: packages/blockly/core/events/events_abstract.ts:41
Whether this event is undoable or not.
Inherited from
isUiEvent
isUiEvent: boolean = false;
Defined in: packages/blockly/core/events/events_abstract.ts:44
Whether or not the event is a UI event.
Inherited from
isBlank
isBlank: boolean = true;
Defined in: packages/blockly/core/events/events_comment_base.ts:29
Whether or not the event was constructed without necessary parameters (to be populated by fromJson).
Inherited from
commentId?
optional commentId?: string;
Defined in: packages/blockly/core/events/events_comment_base.ts:32
The ID of the comment that this event references.
Inherited from
type
type: EventType = EventType.COMMENT_MOVE;
Defined in: packages/blockly/core/events/events_comment_move.ts:25
Type of this event.
Overrides
comment_?
optional comment_?: WorkspaceComment;
Defined in: packages/blockly/core/events/events_comment_move.ts:28
The comment that is being moved.
oldCoordinate_?
optional oldCoordinate_?: Coordinate;
Defined in: packages/blockly/core/events/events_comment_move.ts:32
The location of the comment before the move, in workspace coordinates.
newCoordinate_?
optional newCoordinate_?: Coordinate;
Defined in: packages/blockly/core/events/events_comment_move.ts:35
The location of the comment after the move, in workspace coordinates.
reason?
optional reason?: string[];
Defined in: packages/blockly/core/events/events_comment_move.ts:46
An explanation of what this move is for. Known values include: 'drag' -- A drag operation completed. 'snap' -- Comment got shifted to line up with the grid. 'inbounds' -- Block got pushed back into a non-scrolling workspace. 'create' -- Block created via deserialization. 'cleanup' -- Workspace aligned top-level blocks. Event merging may create multiple reasons: ['drag', 'inbounds', 'snap'].
Methods
getEventWorkspace_()
getEventWorkspace_(): Workspace;
Defined in: packages/blockly/core/events/events_abstract.ts:111
Get workspace the event belongs to.
Returns
The workspace the event belongs to.
Throws
if workspace is null.
Inherited from
CommentBase.getEventWorkspace_
CommentCreateDeleteHelper()
static CommentCreateDeleteHelper(event, create): void;
Defined in: packages/blockly/core/events/events_comment_base.ts:97
Helper function for Comment[Create|Delete]
Parameters
| Parameter | Type | Description |
|---|---|---|
event | CommentCreate | CommentDelete | The event to run. |
create | boolean | if True then Create, if False then Delete |
Returns
void
Inherited from
CommentBase.CommentCreateDeleteHelper
recordNew()
recordNew(): void;
Defined in: packages/blockly/core/events/events_comment_move.ts:67
Record the comment's new location. Called after the move. Can only be called once.
Returns
void
setReason()
setReason(reason): void;
Defined in: packages/blockly/core/events/events_comment_move.ts:88
Sets the reason for a move event.
Parameters
| Parameter | Type | Description |
|---|---|---|
reason | string[] | Why is this move happening? 'drag', 'bump', 'snap', ... |
Returns
void
setOldCoordinate()
setOldCoordinate(xy): void;
Defined in: packages/blockly/core/events/events_comment_move.ts:98
Override the location before the move. Use this if you don't create the event until the end of the move, but you know the original location.
Parameters
| Parameter | Type | Description |
|---|---|---|
xy | Coordinate | The location before the move, in workspace coordinates. |
Returns
void
toJson()
toJson(): CommentMoveJson;
Defined in: packages/blockly/core/events/events_comment_move.ts:108
Encode the event as JSON.
Returns
JSON representation.
Overrides
isNull()
isNull(): boolean;
Defined in: packages/blockly/core/events/events_comment_move.ts:163
Does this event record any change of state?
Returns
boolean
False if something changed.
Overrides
run()
run(forward): void;
Defined in: packages/blockly/core/events/events_comment_move.ts:172
Run a move event.
Parameters
| Parameter | Type | Description |
|---|---|---|
forward | boolean | True if run forward, false if run backward (undo). |
Returns
void