Navigation
API > API/Plugins > API/Plugins/ScriptableToolsFramework > API/Plugins/ScriptableToolsFramework/UScriptableModularBehaviorTool
Description
SingleClickOrDragBehavior is a combination of a SingleClickBehavior and ClickDragBehavior, 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 ClickDragBehavior 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.
| Name | AddSingleClickOrDragBehavior |
| Type | function |
| Header File | /Engine/Plugins/Runtime/ScriptableToolsFramework/Source/ScriptableToolsFramework/Public/BaseTools/ScriptableModularBehaviorTool.h |
| Include Path | #include "BaseTools/ScriptableModularBehaviorTool.h" |
| Source | /Engine/Plugins/Runtime/ScriptableToolsFramework/Source/ScriptableToolsFramework/Private/BaseTools/ScriptableModularBehaviorTool.cpp |
UFUNCTION (BlueprintCallable, Category="ScriptableTool|Input",
Meta=(AdvancedDisplay="CaptureCheck, CapturePriority, MouseButton, bBeginDragIfClickTargetNotHit, ClickDistanceThreshold"))
void AddSingleClickOrDragBehavior
(
FTestIfHitByClickDelegate IfHitByClick,
FOnHitByClickDelegate OnHitByClick,
FTestCanBeginClickDragSequenceDelegate CanBeginClickDragSequence,
FOnClickPressDelegate OnClickPress,
FOnClickDragDelegate OnClickDrag,
FOnClickReleaseDelegate OnClickRelease,
FOnTerminateDragSequenceDelegate OnTerminateDragSequence,
FMouseBehaviorModiferCheckDelegate CaptureCheck,
int CapturePriority,
EScriptableToolMouseButton MouseButton,
bool bBeginDragIfClickTargetNotHit,
float ClickDistanceThreshold
)
Parameters
| Name | Remarks |
|---|---|
| IfHitByClick | Test if hit by a click |
| OnHitByClick | Notify that click occurred |
| CanBeginClickDragSequence | Test if target can begin click-drag interaction at this point |
| OnClickPress | Notify Target that click press occurred |
| OnClickDrag | Notify Target that input position has changed |
| OnClickRelease | Notify Target that click release occurred |
| OnTerminateDragSequence | Notify Target that click-drag sequence has been explicitly terminated (eg by escape key) |
| CaptureCheck | Only enable capture if returns true |
| CapturePriority | The priority is used to resolve situations where multiple behaviors want the same capture |
| MouseButton | Determines which mouse button the behavior captures on |