RealDocs

FGeometry::IsUnderLocation

function SlateCore Since 4.0
#include "Layout/Geometry.h"
Access: public Specifiers: inlineconst

Description

Returns true if the given absolute coordinate falls within the bounds of this geometry, correctly accounting for render transforms including rotation and skew.

Caveats & Gotchas

  • Uses the accumulated render transform inverse internally — the same cost as AbsoluteToLocal. Avoid calling for large numbers of widgets per frame; Slate already performs this check during its own hit testing pass.
  • For most hit-testing needs you should let Slate's built-in hit-test mechanism handle this via OnMouseEnter/OnMouseLeave or overriding ComputeDesiredSize. Use IsUnderLocation only when you need a manual check outside the normal Slate event flow.
  • The absolute coordinate space must match the space the geometry was built in — mixing desktop-space cursors with window-space geometry produces incorrect results.

Signature

inline bool IsUnderLocation(const UE::Slate::FDeprecateVector2DParameter& AbsoluteCoordinate) const

Parameters

Name Type Description Default
AbsoluteCoordinate const UE::Slate::FDeprecateVector2DParameter& Point in absolute (screen or window) space to test.

Return Type

bool

Example

Manual hover detection inside an OnPaint override C++
bool bIsHovered = MyGeometry.IsUnderLocation(FSlateApplication::Get().GetCursorPos());
if (bIsHovered)
{
	// Draw highlight
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.