Open 3D Engine AzFramework API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzFramework::ClickDetector Class Reference

#include <ClickDetector.h>

Public Types

enum class  ClickEvent { Nil , Down , Up }
 
enum class  ClickOutcome { Nil , Move , Click , Release }
 The type of mouse click. More...
 

Public Member Functions

ClickOutcome DetectClick (ClickEvent clickEvent, const ScreenVector &cursorDelta)
 Called from any type of 'handle event' function.
 
void SetDoubleClickInterval (float doubleClickInterval)
 
void SetDeadZone (float deadZone)
 Override the dead zone before a 'move' outcome will be triggered.
 
void OverrideTimeNowFn (AZStd::function< AZStd::chrono::milliseconds()> timeNowFn)
 
void SetClickDownEventFn (AZStd::function< void()> downEventFn)
 Customization point for when a potential click first begins.
 

Detailed Description

Utility class to help detect different types of mouse click (mouse down and up with no movement), mouse move (down and initial move after some threshold) and mouse release (mouse down with movement and then mouse up).

Member Enumeration Documentation

◆ ClickEvent

Internal representation of click event (map from external event for this when calling DetectClick).

◆ ClickOutcome

The type of mouse click.

Enumerator
Nil 

Not recognized.

Move 

Initial move after mouse down.

Click 

Mouse down and up with no intermediate movement.

Release 

Mouse down with movement and then mouse up.

Member Function Documentation

◆ OverrideTimeNowFn()

void AzFramework::ClickDetector::OverrideTimeNowFn ( AZStd::function< AZStd::chrono::milliseconds()>  timeNowFn)

Override how the current time is retrieved. This is helpful to override when it comes to simulating different passages of time to avoid double click issues in tests for example.

◆ SetDoubleClickInterval()

void AzFramework::ClickDetector::SetDoubleClickInterval ( float  doubleClickInterval)
inline

Override the default double click interval.

Note
Default is 400ms - system default.

The documentation for this class was generated from the following file: