Navigation
API > API/Editor > API/Editor/EditorInteractiveToolsFramework
USingleClickAndDragInputBehavior implements a combination of "button-click" and "button-click-drag"-style input behavior. If the mouse is moved away from the original location, and update will occur and a drag operation will start. If the mouse is released without moving too far away, a click event will occur. Once the drag has started, returning to the original location will not produce a click event will not be produced, but the drag operation will continue.
NOTE: This differs from USingleClickOrDragInputBehavior in that it provides a separate call sequence for click and drag: Single Clicks: OnClickPress OnClickRelease
Drag: OnDragStarted OnClickDrag
An ISingleClickAndDragBehaviorTarget instance must be provided which is manipulated by this behavior.
The state machine works as follows: 1) on input-device-button-press, call Target::CanBeginSingleClickDragSequence to determine if capture should begin 2) on input-device-move, call Target::OnClickDrag if drag mode has been started or Target::OnDragStart if it crosses that threshold. 3) on input-device-button-release, call Target::OnClickRelease
If a ForceEndCapture occurs we call Target::OnTerminateDragClickSequence
| Name | USingleClickAndDragBehavior |
| Type | class |
| Header File | /Engine/Source/Editor/Experimental/EditorInteractiveToolsFramework/Public/Behaviors/SingleClickAndDragBehavior.h |
| Include Path | #include "Behaviors/SingleClickAndDragBehavior.h" |
Syntax
UCLASS (MinimalAPI)
class USingleClickAndDragBehavior : public UAnyButtonInputBehavior
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UInputBehavior → UAnyButtonInputBehavior → USingleClickAndDragBehavior
Derived Classes
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bBeginDragIfClickTargetNotHit | bool | If true (default), then if the click-mouse-down does not hit a valid click target (determined by IClickBehaviorTarget::IsHitByClick), then the Drag will be initiated | Behaviors/SingleClickAndDragBehavior.h | |
| DragDistanceThreshold | float | If the device moves more than this distance in 2D (pixel?) units, the interaction switches from click to drag | Behaviors/SingleClickAndDragBehavior.h | |
| ModifierCheckFunc | TFunction< bool(const FInputDeviceState &)> | WantsCapture() will only return capture request if this function returns true (or is null) | Behaviors/SingleClickAndDragBehavior.h | |
| Modifiers | FInputBehaviorModifierStates | The modifier set for this behavior | Behaviors/SingleClickAndDragBehavior.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bHasActiveCapture | bool | Set to true between BeginCapture and capture end (release/force-end). | Behaviors/SingleClickAndDragBehavior.h | |
| bImmediatelyBeginDragInBeginCapture | bool | Flag used to communicate between WantsCapture and BeginCapture | Behaviors/SingleClickAndDragBehavior.h | |
| bImmediatelyClickInBeginCapture | bool | Flag used to communicate between WantsCapture and BeginCapture | Behaviors/SingleClickAndDragBehavior.h | |
| bIsBeyondDragDistance | bool | Updated to mark whether mouse movement has moved beyond drag distance | Behaviors/SingleClickAndDragBehavior.h | |
| bIsDragging | bool | Set to true if we are in an active drag capture, eg after rejecting possible click | Behaviors/SingleClickAndDragBehavior.h | |
| CaptureSide | EInputCaptureSide | Device capture | Behaviors/SingleClickAndDragBehavior.h | |
| InitialMouseDownRay | TOptional< FInputDeviceRay > | The initial mouse down position. | Behaviors/SingleClickAndDragBehavior.h | |
| PendingDragPriority | TOptional< FInputCapturePriority > | When set, the drag priority used when mouse motion has not yet moved byond the minimum drag distance. | Behaviors/SingleClickAndDragBehavior.h | |
| Target | ISingleClickAndDragBehaviorTarget * | Click and Drag Target object. | Behaviors/SingleClickAndDragBehavior.h | |
| UseUnboundedCursor | TAttribute< bool > | Behaviors/SingleClickAndDragBehavior.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void SetPendingDragPriority
(
TOptional< FInputCapturePriority > InPriority |
Behaviors/SingleClickAndDragBehavior.h | ||
void SetUsesUnboundedCursor
(
TAttribute< bool > InUsesUnboundedCursor |
Behaviors/SingleClickAndDragBehavior.h | ||
bool UsesUnboundedCursor() |
Behaviors/SingleClickAndDragBehavior.h |
Public Virtual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Initialize
(
ISingleClickAndDragBehaviorTarget* InTarget |
Set the targets for Click and Drag interactions | Behaviors/SingleClickAndDragBehavior.h |
Overridden from UAnyButtonInputBehavior
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FInputDeviceRay GetDeviceRay
(
const FInputDeviceState& InInputDeviceState |
Behaviors/SingleClickAndDragBehavior.h |
Overridden from UInputBehavior
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FInputCaptureUpdate BeginCapture
(
const FInputDeviceState& InInputState, |
Behaviors/SingleClickAndDragBehavior.h | ||
virtual void ForceEndCapture
(
const FInputCaptureData& InCaptureData |
Behaviors/SingleClickAndDragBehavior.h | ||
virtual FInputCapturePriority GetPriority() |
Behaviors/SingleClickAndDragBehavior.h | ||
virtual FInputCaptureUpdate UpdateCapture
(
const FInputDeviceState& InInputState, |
Behaviors/SingleClickAndDragBehavior.h | ||
virtual FInputCaptureRequest WantsCapture
(
const FInputDeviceState& InInputState |
Behaviors/SingleClickAndDragBehavior.h |
Protected Virtual
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnClickDragInternal
(
const FInputDeviceState& InInput, |
Internal function that forwards click evens to Target::OnClickDrag, you can customize behavior here | Behaviors/SingleClickAndDragBehavior.h | |
virtual void OnClickPressInternal
(
const FInputDeviceState& InInput, |
Internal function that forwards click evens to Target::OnClickPress, you can customize behavior here | Behaviors/SingleClickAndDragBehavior.h | |
virtual void OnClickReleaseInternal
(
const FInputDeviceState& InInput, |
Internal function that forwards click evens to Target::OnClickRelease, you can customize behavior here | Behaviors/SingleClickAndDragBehavior.h | |
virtual void OnDragStartedInternal
(
const FInputDeviceState& InInput, |
Internal function that forwards click evens to Target::OnDragStarted, you can customize behavior here | Behaviors/SingleClickAndDragBehavior.h |