docs.unity3d.com
    Show / Hide Table of Contents

    Class Draggable

    Manipulator which monitors Press, Hold and Release events in order to drag visuals.

    Inheritance
    Object
    Manipulator
    Pressable
    Draggable
    Inherited Members
    Pressable.clicked
    Pressable.clickedWithEventInfo
    Pressable.longClicked
    Pressable.active
    Pressable.longPressDuration
    Pressable.keepEventPropagation
    Pressable.ForceActivePseudoState()
    Pressable.RegisterCallbacksOnTarget()
    Pressable.UnregisterCallbacksFromTarget()
    Manipulator.target
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.AppUI.UI
    Syntax
    public class Draggable : Pressable, IManipulator

    Constructors

    Draggable(Action, Action<Draggable>, Action<Draggable>, Action<Draggable>)

    Construct a Draggable manipulator.

    Declaration
    public Draggable(Action clickHandler, Action<Draggable> dragHandler, Action<Draggable> upHandler, Action<Draggable> downHandler = null)
    Parameters
    Type Name Description
    Action clickHandler

    A callback invoked when a ClickEvent has been received.

    Action<Draggable> dragHandler

    A callback invoked during dragging state.

    Action<Draggable> upHandler

    A callback invoked when a PointerUpEvent has been received.

    Action<Draggable> downHandler

    A callback invoked when a PointerDownEvent has been received.

    Properties

    deltaPos

    The delta position between the last frame and the current one.

    Declaration
    public Vector2 deltaPos { get; }
    Property Value
    Type Description
    Vector2

    hasMoved

    Has the pointer moved since the last PointerDownEvent.

    Declaration
    public bool hasMoved { get; }
    Property Value
    Type Description
    Boolean

    localPosition

    The local position received from the imGui native event.

    Declaration
    public Vector2 localPosition { get; }
    Property Value
    Type Description
    Vector2

    position

    The world position received from the imGui native event.

    Declaration
    public Vector2 position { get; }
    Property Value
    Type Description
    Vector2

    Methods

    Cancel()

    Cancel the drag operation.

    Declaration
    public void Cancel()

    ProcessDownEvent(EventBase, Vector2, Int32)

    This method processes the down event sent to the target Element.

    Declaration
    protected override void ProcessDownEvent(EventBase evt, Vector2 localPosition, int pointerId)
    Parameters
    Type Name Description
    EventBase evt

    The event to process.

    Vector2 localPosition

    The local position of the pointer.

    Int32 pointerId

    The pointer id of the pointer.

    Overrides
    Pressable.ProcessDownEvent(EventBase, Vector2, Int32)

    ProcessMoveEvent(EventBase, Vector2)

    This method processes the move event sent to the target Element.

    Declaration
    protected override void ProcessMoveEvent(EventBase evt, Vector2 localPosition)
    Parameters
    Type Name Description
    EventBase evt

    The event to process.

    Vector2 localPosition

    The local position of the pointer.

    Overrides
    Pressable.ProcessMoveEvent(EventBase, Vector2)

    ProcessUpEvent(EventBase, Vector2, Int32)

    This method processes the up event sent to the target Element.

    Declaration
    protected override void ProcessUpEvent(EventBase evt, Vector2 localPosition, int pointerId)
    Parameters
    Type Name Description
    EventBase evt

    The event to process.

    Vector2 localPosition

    The local position of the pointer.

    Int32 pointerId

    The pointer id of the pointer.

    Overrides
    Pressable.ProcessUpEvent(EventBase, Vector2, Int32)
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023