Draggable Element UGUI

🧲 DraggableElementUGUI Class

A draggable uGUI element.

Namespace: Esper.Inventool.UI.UGUI Access: public Type: class Inherits: MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IDragHandler, IBeginDragHandler, IEndDragHandler


📦 Fields

Access
Field
Type
Description

protected

pointerDown

bool

True while the pointer button is held on the element.

protected

dragStarted

bool

True after a drag has begun.

protected

dragAllowedGetter

Func<bool>

Getter used to determine if dragging is allowed.

public

onDragStarted

Action

Callback invoked when dragging begins.

public

onDrag

Action

Callback invoked while the element is being dragged.

public

onDropped

Action

Callback invoked when the element is dropped.

protected

pointerMovePosition

Vector2

Current pointer position during drag.

protected

pointerDownPosition

Vector2

Pointer position at the start of the drag.

public

isPointerInside

bool

True if the pointer is currently inside this element.


🧰 Methods

Access
Method
Returns
Description

private

OnDisable()

void

Stops dragging and resets state when the component is disabled.

public

OnBeginDrag(PointerEventData eventData)

void

Begins drag if left mouse button and dragging is allowed.

public

ForceStopDrag()

void

Forces dragging to stop.

public

OnDrag(PointerEventData eventData)

void

Updates pointer positions and invokes drag callbacks.

public

OnEndDrag(PointerEventData eventData)

void

Ends drag on left mouse release and invokes drop callback.

public virtual

OnPointerEnter(PointerEventData eventData)

void

Marks the pointer as inside this element.

public virtual

OnPointerExit(PointerEventData eventData)

void

Marks the pointer as outside this element.

Last updated