Stay organized with collections
Save and categorize content based on your preferences.
blockly > Events > CommentMove
Notifies listeners that a workspace comment has moved.
Signature:
export declare class CommentMove extends CommentBase
Extends: CommentBase
Constructors
Properties
Property |
Modifiers |
Type |
Description |
comment_? |
|
WorkspaceComment |
(Optional) The comment that is being moved. |
newCoordinate_? |
|
Coordinate |
(Optional) The location of the comment after the move, in workspace coordinates. |
oldCoordinate_? |
|
Coordinate |
(Optional) The location of the comment before the move, in workspace coordinates. |
reason? |
|
string[] |
(Optional) 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']. |
type |
|
EventType |
|
Methods
Method |
Modifiers |
Description |
isNull() |
|
Does this event record any change of state? |
recordNew() |
|
Record the comment's new location. Called after the move. Can only be called once. |
run(forward) |
|
Run a move event. |
setOldCoordinate(xy) |
|
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. |
setReason(reason) |
|
Sets the reason for a move event. |
toJson() |
|
Encode the event as JSON. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-16 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eCommentMove\u003c/code\u003e class in Blockly's Events namespace handles events related to workspace comment movements.\u003c/p\u003e\n"],["\u003cp\u003eThis class extends the \u003ccode\u003eCommentBase\u003c/code\u003e class and provides properties to access the comment, its old and new coordinates, and the reason for the move.\u003c/p\u003e\n"],["\u003cp\u003eIt includes methods to check for state changes, record the new location, run the move event, set the old coordinates and reason, and encode the event as JSON.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCommentMove\u003c/code\u003e event is triggered when a comment is moved within the Blockly workspace, providing information about the comment's movement and its context.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [Events](./blockly.events_namespace.md) \\\u003e [CommentMove](./blockly.events_namespace.commentmove_class.md)\n\nEvents.CommentMove class\n\nNotifies listeners that a workspace comment has moved.\n\n**Signature:** \n\n export declare class CommentMove extends CommentBase \n\n**Extends:** [CommentBase](./blockly.events_namespace.commentbase_class.md)\n\nConstructors\n\n| Constructor | Modifiers | Description |\n|-----------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------------|\n| [(constructor)(opt_comment)](./blockly.events_namespace.commentmove_class._constructor__1_constructor.md) | | Constructs a new instance of the `CommentMove` class |\n\nProperties\n\n| Property | Modifiers | Type | Description |\n|--------------------------------------------------------------------------------------------|-----------|----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [comment_?](./blockly.events_namespace.commentmove_class.comment__property.md) | | [WorkspaceComment](./blockly.comments_namespace.workspacecomment_class.md) | *(Optional)* The comment that is being moved. |\n| [newCoordinate_?](./blockly.events_namespace.commentmove_class.newcoordinate__property.md) | | [Coordinate](./blockly.utils_namespace.coordinate_class.md) | *(Optional)* The location of the comment after the move, in workspace coordinates. |\n| [oldCoordinate_?](./blockly.events_namespace.commentmove_class.oldcoordinate__property.md) | | [Coordinate](./blockly.utils_namespace.coordinate_class.md) | *(Optional)* The location of the comment before the move, in workspace coordinates. |\n| [reason?](./blockly.events_namespace.commentmove_class.reason_property.md) | | string\\[\\] | *(Optional)* 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'\\]. |\n| [type](./blockly.events_namespace.commentmove_class.type_property.md) | | EventType | |\n\nMethods\n\n| Method | Modifiers | Description |\n|---------------------------------------------------------------------------------------------------|-----------|----------------------------------------------------------------------------------------------------------------------------------------------|\n| [isNull()](./blockly.events_namespace.commentmove_class.isnull_1_method.md) | | Does this event record any change of state? |\n| [recordNew()](./blockly.events_namespace.commentmove_class.recordnew_1_method.md) | | Record the comment's new location. Called after the move. Can only be called once. |\n| [run(forward)](./blockly.events_namespace.commentmove_class.run_1_method.md) | | Run a move event. |\n| [setOldCoordinate(xy)](./blockly.events_namespace.commentmove_class.setoldcoordinate_1_method.md) | | 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. |\n| [setReason(reason)](./blockly.events_namespace.commentmove_class.setreason_1_method.md) | | Sets the reason for a move event. |\n| [toJson()](./blockly.events_namespace.commentmove_class.tojson_1_method.md) | | Encode the event as JSON. |"]]