Navigation
API > API/Runtime > API/Runtime/InteractiveToolsFramework
USingleClickOrDragInputBehavior is a combination of a USingleClickBehavior and UClickDragBehavior, and allows for the common UI interaction where a click-and-release does one action, but if the mouse is moved, then a drag interaction is started. For example click-to-select is often combined with a drag-marquee-rectangle in this way. This can be directly implemented with a UClickDragBehavior but requires the client to (eg) detect movement thresholds, etc. This class encapsulates all that state/logic.
The .ClickDistanceThreshold parameter determines how far the mouse must move (in whatever device units are in use) to switch from a click to drag interaction
The .bBeginDragIfClickTargetNotHit parameter determines if the drag interaction will be immediately initiated if the initial 'click' mouse-down does not hit a valid clickable target. Defaults to true.
The hit-test and on-clicked functions are provided by a IClickBehaviorTarget instance, while an IClickDragBehaviorTarget provides the can-click-drag/begin-drag/update-drag/end-drag functionality.
| Name | USingleClickOrDragInputBehavior |
| Type | class |
| Header File | /Engine/Source/Runtime/InteractiveToolsFramework/Public/BaseBehaviors/SingleClickOrDragBehavior.h |
| Include Path | #include "BaseBehaviors/SingleClickOrDragBehavior.h" |
Syntax
UCLASS (MinimalAPI)
class USingleClickOrDragInputBehavior : public UAnyButtonInputBehavior
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UInputBehavior → UAnyButtonInputBehavior → USingleClickOrDragInputBehavior
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 | BaseBehaviors/SingleClickOrDragBehavior.h | |
| ClickDistanceThreshold | float | If the device moves more than this distance in 2D (pixel?) units, the interaction switches from click to drag | BaseBehaviors/SingleClickOrDragBehavior.h | |
| ModifierCheckFunc | TFunction< bool(const FInputDeviceState &)> | WantsCapture() will only return capture request if this function returns true (or is null) | BaseBehaviors/SingleClickOrDragBehavior.h | |
| Modifiers | FInputBehaviorModifierStates | The modifier set for this behavior | BaseBehaviors/SingleClickOrDragBehavior.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void Initialize
(
IClickBehaviorTarget* ClickTarget, |
Set the targets for Click and Drag interactions | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual void SetDragTarget
(
IClickDragBehaviorTarget* DragTarget |
Change the Drag BehaviorTarget | BaseBehaviors/SingleClickOrDragBehavior.h |
Overridden from UInputBehavior
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FInputCaptureUpdate BeginCapture
(
const FInputDeviceState& InputState, |
Called after WantsCapture() returns a capture request that was accepted | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual void ForceEndCapture
(
const FInputCaptureData& CaptureData |
If this is called, the Behavior has forcibly lost capture (eg due to app losing focus for example) and needs to clean up accordingly | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual FInputCaptureUpdate UpdateCapture
(
const FInputDeviceState& InputState, |
Called for each new input event during a capture sequence. | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual FInputCaptureRequest WantsCapture
(
const FInputDeviceState& InputState |
Given the input state, does this Behavior want to begin capturing some input devices? | BaseBehaviors/SingleClickOrDragBehavior.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnClickDragInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to DragTarget::OnClickDrag, you can customize behavior here | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual void OnClickDragPressInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to DragTarget::OnClickPress, you can customize behavior here | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual void OnClickDragReleaseInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to DragTarget::OnClickRelease, you can customize behavior here | BaseBehaviors/SingleClickOrDragBehavior.h | |
virtual void OnClickedInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to ClickTarget::OnClicked, you can customize behavior here | BaseBehaviors/SingleClickOrDragBehavior.h |