blockly > Events > CommentMove

Events.CommentMove class

Notifies listeners that a workspace comment has moved.

Signature:

export declare class CommentMove extends CommentBase 

Extends: CommentBase

Constructors

Constructor Modifiers Description
(constructor)(opt_comment) Constructs a new instance of the CommentMove class

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 string

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.