Menu
Lumberyard
Developer Guide (Version 1.11)

UIDraggableComponent

You can use a draggable component to make an element draggable for drag-and-drop behavior.

UiDraggableBus

Services messages for the UiDraggableComponent.

GetCanDropOnAnyCanvas

Gets the flag that indicates whether this draggable can be dropped on this canvas or any loaded canvas.

Syntax

Copy
bool GetCanDropOnAnyCanvas()

GetDragState

Returns the current drag state of the draggable component.

Syntax

Copy
eUiDragState GetDragState()

Following are possible values for eUiDragState.

Copy
enum eUiDragState { eUiDragState_Normal, eUiDragState_Valid, eUiDragState_Invalid };

GetOriginalFromProxy

Gets the original draggable component from a draggable component that is acting as a proxy.

Syntax

Copy
AZ::EntityId GetOriginalFromProxy()

IsProxy

Checks whether a draggable component is acting as a proxy for another draggable component.

Syntax

Copy
bool IsProxy()

ProxyDragEnd

Concludes the drag of a proxy. Call ProxyDragEnd at the end of a drag if SetAsProxy was used for the drag. Call ProxyDragEnd from the OnDragEnd handler of the proxy element. This results in a call to OnDragEnd for the original draggable component.

Syntax

Copy
void ProxyDragEnd(AZ::Vector2 point)

RedoDrag

Causes the draggable component to redetect the drop targets that are underneath the pointer and resend OnDropHoverStart or OnDropHoverEnd messages if needed. You can call RedoDrag from a script after the script has caused drop targets to change positions. This function is most useful for keyboard or gamepad navigation.

Syntax

Copy
void RedoDrag(AZ::Vector2 point)

SetAsProxy

Sets a draggable component to act as a proxy for another draggable component and starts dragging the draggable component at the specified point. A proxy is useful if you want the visible element being dragged to be on a canvas other than the one on which the original draggable component is selected. It is also useful if you want to avoid moving the original draggable component.

Syntax

Copy
void SetAsProxy(AZ::EntityId originalDraggableId, AZ::Vector2 point)

SetCanDropOnAnyCanvas

Sets the flag that indicates whether a draggable can be dropped on this canvas or any loaded canvas.

Syntax

Copy
void SetCanDropOnAnyCanvas(bool anyCanvas)

SetDragState

Sets the current drag state of the draggable component.

Syntax

Copy
void SetDragState(eUiDragState dragState)

For possible values for eUiDragState, see GetDragState.

UiDraggableNotificationBus

Services notifications for the UiDraggableComponent.

OnDrag

Occurs each time the drag position changes during dragging. OnDrag events happen only between OnDragStart and OnDragEnd events.

Syntax

Copy
void OnDrag(AZ::Vector2 position)

OnDragEnd

Occurs at the end of dragging when the release input event occurs. The OnDragEnd notification is sent before the OnDrop drop target notification.

Syntax

Copy
void OnDragEnd(AZ::Vector2 position)

OnDragStart

Occurs when dragging is detected on the draggable component. For mouse or touch input, this occurs when movement has been detected after the press or touch.

Syntax

Copy
void OnDragStart(AZ::Vector2 position)