Slate.CursorSignificantMoveDetectionThreshold
Slate.CursorSignificantMoveDetectionThreshold
#Overview
name: Slate.CursorSignificantMoveDetectionThreshold
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
The distance from previous cursor position above which the move will be considered significant (used to trigger the display of the tooltips).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of Slate.CursorSignificantMoveDetectionThreshold is to define a threshold for detecting significant cursor movements in the Slate UI framework. This setting is used to determine when to trigger the display of tooltips based on cursor movement.
This setting variable is primarily used in the Slate subsystem of Unreal Engine, which is responsible for handling the user interface. Specifically, it’s used in the SlateUser module, which manages user input and cursor behavior.
The value of this variable is set through a console variable (CVar) system. It’s defined using FAutoConsoleVariableRef, which allows it to be modified at runtime through console commands or configuration files.
The associated variable CursorSignificantMoveDetectionThreshold interacts directly with Slate.CursorSignificantMoveDetectionThreshold. They share the same value, with the CVar acting as an interface for external modification.
Developers should be aware that this variable affects the sensitivity of cursor movement detection. A lower value will make the system more sensitive to small cursor movements, potentially causing tooltips to appear more frequently. Conversely, a higher value will require larger cursor movements to trigger tooltip displays.
Best practices when using this variable include:
- Adjusting it based on the specific needs of your UI design and user experience requirements.
- Testing different values to find the right balance between responsiveness and avoiding unnecessary tooltip triggers.
- Considering accessibility implications, as users with motor control difficulties might benefit from a higher threshold.
Regarding the associated variable CursorSignificantMoveDetectionThreshold:
- It’s a static float variable used internally in the SlateUser.cpp file.
- It’s used in the UpdateCursor() function of the FSlateUser class to calculate if a cursor movement is significant enough to update the LastCursorSignificantMoveTime.
- The value is squared and compared against the squared distance between the previous and current cursor positions.
- Developers should be aware that changes to Slate.CursorSignificantMoveDetectionThreshold will directly affect this internal variable and, consequently, the behavior of cursor movement detection in the Slate system.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:58
Scope: file
Source code excerpt:
static float CursorSignificantMoveDetectionThreshold = 0.0;
FAutoConsoleVariableRef CVarCursorSignificantMoveDetectionThreshold(
TEXT("Slate.CursorSignificantMoveDetectionThreshold"),
CursorSignificantMoveDetectionThreshold,
TEXT("The distance from previous cursor position above which the move will be considered significant (used to trigger the display of the tooltips)."));
//////////////////////////////////////////////////////////////////////////
// FSlateVirtualUserHandle
//////////////////////////////////////////////////////////////////////////
#Associated Variable and Callsites
This variable is associated with another variable named CursorSignificantMoveDetectionThreshold
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:56
Scope: file
Source code excerpt:
TEXT("How long it takes for a tooltip to animate into view, in seconds."));
static float CursorSignificantMoveDetectionThreshold = 0.0;
FAutoConsoleVariableRef CVarCursorSignificantMoveDetectionThreshold(
TEXT("Slate.CursorSignificantMoveDetectionThreshold"),
CursorSignificantMoveDetectionThreshold,
TEXT("The distance from previous cursor position above which the move will be considered significant (used to trigger the display of the tooltips)."));
//////////////////////////////////////////////////////////////////////////
// FSlateVirtualUserHandle
//////////////////////////////////////////////////////////////////////////
#Loc: <Workspace>/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp:899
Scope (from outer to inner):
file
function void FSlateUser::UpdateCursor
Source code excerpt:
}
const double MoveEpsilonSquared = CursorSignificantMoveDetectionThreshold * CursorSignificantMoveDetectionThreshold;
if (FVector2D::DistSquared(GetPreviousCursorPosition(), GetCursorPosition()) > MoveEpsilonSquared)
{
LastCursorSignificantMoveTime = FPlatformTime::Seconds();
}
}