Navigation
API > API/Runtime > API/Runtime/InteractiveToolsFramework > API/Runtime/InteractiveToolsFramework/BaseBehaviors
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UInputBehavior
- UAnyButtonInputBehavior
- USingleClickOrDragInputBehavior
References
| Module | InteractiveToolsFramework |
| Header | /Engine/Source/Runtime/InteractiveToolsFramework/Public/BaseBehaviors/SingleClickOrDragBehavior.h |
| Include | #include "BaseBehaviors/SingleClickOrDragBehavior.h" |
Syntax
class USingleClickOrDragInputBehavior : public UAnyButtonInputBehavior
Remarks
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.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bBeginDragIfClickTargetNotHit | 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 | |
| bool | bImmediatelyBeginDragInBeginCapture | Flag used to communicate between WantsCapture and BeginCapture | |
| bool | bInDrag | Set to true if we are in an active drag capture, eg after rejecting possible click | |
| EInputCaptureSide | CaptureSide | Device capture | |
| float | ClickDistanceThreshold | If the device moves more than this distance in 2D (pixel?) units, the interaction switches from click to drag | |
| IClickBehaviorTarget * | ClickTarget | Click Target object | |
| IClickDragBehaviorTarget * | DragTarget | Drag Target object | |
| TFunction< bool(const FInputDeviceState &)> | ModifierCheckFunc | WantsCapture() will only return capture request if this function returns true (or is null) | |
| FInputBehaviorModifierStates | Modifiers | The modifier set for this behavior | |
| FVector2D | MouseDownPosition2D | Click-down position, to determine if mouse has moved far enough to swap to drag interaction | |
| FRay | MouseDownRay |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Initialize
(
IClickBehaviorTarget* ClickTarget, |
Set the targets for Click and Drag interactions | |
| void | OnClickDragInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to DragTarget::OnClickDrag, you can customize behavior here | |
| void | OnClickDragPressInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to DragTarget::OnClickPress, you can customize behavior here | |
| void | OnClickDragReleaseInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to DragTarget::OnClickRelease, you can customize behavior here | |
| void | OnClickedInternal
(
const FInputDeviceState& Input, |
Internal function that forwards click evens to ClickTarget::OnClicked, you can customize behavior here | |
| void | SetDragTarget
(
IClickDragBehaviorTarget* DragTarget |
Change the Drag BehaviorTarget |
Overridden from UInputBehavior
| Type | Name | Description | |
|---|---|---|---|
| FInputCaptureUpdate | BeginCapture
(
const FInputDeviceState& InputState, |
Called after WantsCapture() returns a capture request that was accepted | |
| 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 | |
| FInputCaptureUpdate | UpdateCapture
(
const FInputDeviceState& InputState, |
Called for each new input event during a capture sequence. | |
| FInputCaptureRequest | WantsCapture
(
const FInputDeviceState& InputState |
Given the input state, does this Behavior want to begin capturing some input devices? |