Class: ViewportChange
Defined in: packages/blockly/core/events/events_viewport.ts:26
Notifies listeners that the workspace surface's position or scale has changed.
Does not notify when the workspace itself resizes.
Extends
Properties index
| Property | Description |
|---|---|
| group | An ID for the group of events this block is associated with. |
| isBlank | Whether or not the event was constructed without necessary parameters (to be populated by fromJson). |
| workspaceId | The workspace identifier for this event. |
| recordUndo | Whether this event is undoable or not. |
| isUiEvent | Whether or not the event is a UI event. |
| viewTop | Top edge of the visible portion of the workspace, relative to the workspace origin. |
| viewLeft | The left edge of the visible portion of the workspace, relative to the workspace origin. |
| scale | The scale of the workpace. |
| oldScale | The previous scale of the workspace. |
| type | Type of this event. |
Methods index
| Method | Description |
|---|---|
| isNull | Does this event record any change of state? |
| run | Run an event. |
| getEventWorkspace_ | Get workspace the event belongs to. |
| toJson | Encode the event as JSON. |
Constructors
Constructor
new ViewportChange(
opt_top?,
opt_left?,
opt_scale?,
opt_workspaceId?,
opt_oldScale?
): ViewportChange;
Defined in: packages/blockly/core/events/events_viewport.ts:58
Parameters
| Parameter | Type | Description |
|---|---|---|
opt_top? | number | Top-edge of the visible portion of the workspace, relative to the workspace origin. Undefined for a blank event. |
opt_left? | number | Left-edge of the visible portion of the workspace relative to the workspace origin. Undefined for a blank event. |
opt_scale? | number | The scale of the workspace. Undefined for a blank event. |
opt_workspaceId? | string | The workspace identifier for this event. Undefined for a blank event. |
opt_oldScale? | number | The old scale of the workspace. Undefined for a blank event. |
Returns
ViewportChange
Overrides
Properties
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
isBlank
isBlank: boolean = true;
Defined in: packages/blockly/core/events/events_ui_base.ts:25
Whether or not the event was constructed without necessary parameters (to be populated by fromJson).
Inherited from
workspaceId
workspaceId: string;
Defined in: packages/blockly/core/events/events_ui_base.ts:26
The workspace identifier for this event.
Inherited from
recordUndo
recordUndo: boolean = false;
Defined in: packages/blockly/core/events/events_ui_base.ts:29
Whether this event is undoable or not.
Inherited from
isUiEvent
isUiEvent: boolean = true;
Defined in: packages/blockly/core/events/events_ui_base.ts:32
Whether or not the event is a UI event.
Inherited from
viewTop?
optional viewTop?: number;
Defined in: packages/blockly/core/events/events_viewport.ts:31
Top edge of the visible portion of the workspace, relative to the workspace origin.
viewLeft?
optional viewLeft?: number;
Defined in: packages/blockly/core/events/events_viewport.ts:37
The left edge of the visible portion of the workspace, relative to the workspace origin.
scale?
optional scale?: number;
Defined in: packages/blockly/core/events/events_viewport.ts:40
The scale of the workpace.
oldScale?
optional oldScale?: number;
Defined in: packages/blockly/core/events/events_viewport.ts:43
The previous scale of the workspace.
type
type: EventType = EventType.VIEWPORT_CHANGE;
Defined in: packages/blockly/core/events/events_viewport.ts:45
Type of this event.
Overrides
Methods
isNull()
isNull(): boolean;
Defined in: packages/blockly/core/events/events_abstract.ts:91
Does this event record any change of state?
Returns
boolean
True if null, false if something changed.
Inherited from
run()
run(_forward): void;
Defined in: packages/blockly/core/events/events_abstract.ts:100
Run an event.
Parameters
| Parameter | Type | Description |
|---|---|---|
_forward | boolean | True if run forward, false if run backward (undo). |
Returns
void
Inherited from
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
toJson()
toJson(): ViewportChangeJson;
Defined in: packages/blockly/core/events/events_viewport.ts:78
Encode the event as JSON.
Returns
JSON representation.