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 |