Class Dragger
Manipulator that allows dragging from a container component.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class Dragger : PointerManipulator, IManipulator
Constructors
Dragger(Action<PointerMoveEvent>, Action<PointerMoveEvent>, Action<PointerUpEvent>, Action)
Creates a new Dragger instance.
Declaration
public Dragger(Action<PointerMoveEvent> dragStarted, Action<PointerMoveEvent> dragging, Action<PointerUpEvent> dragEnded, Action dragCanceled)
Parameters
Type | Name | Description |
---|---|---|
Action<PointerMoveEvent> | dragStarted | The event that will be fired when a drag starts. |
Action<PointerMoveEvent> | dragging | The event that will be fired when a drag is in progress. |
Action<PointerUpEvent> | dragEnded | The event that will be fired when a drag ends. |
Action | dragCanceled | The event that will be fired when a drag is cancelled. |
Properties
acceptDrag
Delegate that will be called when a drag should be accepted when the dragger wants to become active during PointerMoveEvent.
Declaration
public Func<bool> acceptDrag { get; set; }
Property Value
Type | Description |
---|---|
Func<bool> |
Remarks
If this delegate is not set (or set to null), the drag will be accepted by default.
acceptStartDrag
Delegate that will be called when a drag should be accepted during PointerDownEvent.
Declaration
public Func<Vector2, bool> acceptStartDrag { get; set; }
Property Value
Type | Description |
---|---|
Func<Vector2, bool> |
Remarks
If this delegate is not set (or set to null), the drag will be accepted by default.
dragThreshold
The threshold in pixels after which a drag will start.
Declaration
public float dragThreshold { get; set; }
Property Value
Type | Description |
---|---|
float |
Remarks
The default value is 8 pixels.
isActive
Whether the drag is currently active.
Declaration
public bool isActive { get; }
Property Value
Type | Description |
---|---|
bool |
Methods
Cancel()
Cancels the drag.
Declaration
public void Cancel()
RegisterCallbacksOnTarget()
Called to register event callbacks on the target element.
Declaration
protected override void RegisterCallbacksOnTarget()
Overrides
UnregisterCallbacksFromTarget()
Called to unregister event callbacks from the target element.
Declaration
protected override void UnregisterCallbacksFromTarget()