EntityGizmo

Extends: Control

Source: EntityGizmo.ts:67

On-map gizmo for translating and rotating entities.


Constructor

new EntityGizmo(options?: IEntityGizmoParams): EntityGizmo

Parameters

  • options (IEntityGizmoParams, optional) — Gizmo options:
    • options.tools (GizmoTools, optional) — Gizmo tool set, i.e., which handles are shown. translate shows move axes and planes only, full adds rotation rings. Orthogonal to editMode.
    • options.editMode (EditModeName, optional) — Rotation mode. native rotates in the entity's own frame, yaw rotates in the local horizon frame. Affects the rotation rings only, so it does nothing with tools: "translate".
    • options.autoSelect (boolean, optional) — When true, a left click on a map entity selects it and a left click anywhere else drops the selection. When false, clicks do not change the gizmo selection, so the host application stays the only source of the selection. Default is true.

Instance Methods

selectEntity(entity: Entity)

Shows the gizmo on the given entity. Activates the control when it is inactive. Changing the selection cancels any running gesture on the previously selected entity.

Parameters

  • entity (Entity) — Entity to transform.

unselectEntity()

Hides the gizmo and drops the selection. Cancels a running gesture.

getSelectedEntity(): Entity | null

Returns the selected entity or null.

Returns

isTransforming(): boolean

Returns true while a drag gesture is running.

Returns

  • boolean

getActiveTransform(): IGizmoTransformEvent | null

Returns the running gesture description or null.

Returns

  • IGizmoTransformEvent | null

cancelTransform(): boolean

Cancels the current gesture and restores the entity transform when possible.

Returns

  • boolean — Whether a gesture was cancelled.

oninit()

Inherited from Control#oninit

Overrides: Control#oninit

Control initialization function have to be overridden.

onadd()

Inherited from Control#onadd

Overrides: Control#onadd

Control renderer assigning function have to be overridden.

onremove()

Inherited from Control#onremove

Overrides: Control#onremove

Control remove function have to be overridden.

onactivate()

Inherited from Control#onactivate

Overrides: Control#onactivate

Control activation function have to be overridden.

ondeactivate()

Inherited from Control#ondeactivate

Overrides: Control#ondeactivate

Control deactivation function have to be overriden.

addTo()

Inherited from Control#addTo

Overrides: Control#addTo

Assign renderer to the control.

remove()

Inherited from Control#remove

Overrides: Control#remove

Removes control.

activate()

Inherited from Control#activate

Overrides: Control#activate

Activate control.

deactivate()

Inherited from Control#deactivate

Overrides: Control#deactivate

Deactivate control.

isActive()

Inherited from Control#isActive

Overrides: Control#isActive

Is control active.

Instance Fields

tools

Gizmo tool set: which handles are shown.

editMode

Rotation mode of the rotation rings. Does nothing with tools: "translate".

autoSelect

When false, a left click neither selects a map entity nor drops the current selection.

name

Inherited from Control#name

Overrides: Control#name

Returns control name.

Returns

  • string