FGeometry::LocalToAbsolute
#include "Layout/Geometry.h"
Access: public
Specifiers: inlineconst
Description
Transforms a point from this widget's local space into absolute (screen or window) space by applying the accumulated render transform.
Caveats & Gotchas
- • Uses the accumulated render transform, not just the layout transform — if the widget has a render-only rotation or skew, the result differs from what you'd get by multiplying Scale and AbsolutePosition manually.
- • The returned absolute space can be window-relative or desktop-relative depending on how the root widget was set up. Pass the result to a USlateBlueprintLibrary viewport conversion function if you need viewport pixel coordinates.
- • Inverting the transform is done by AbsoluteToLocal, which involves a matrix inverse and is slightly more expensive than LocalToAbsolute.
Signature
inline UE::Slate::FDeprecateVector2DResult LocalToAbsolute(UE::Slate::FDeprecateVector2DParameter LocalCoordinate) const Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| LocalCoordinate | UE::Slate::FDeprecateVector2DParameter | A point in the widget's local space, where (0,0) is the widget's top-left corner. | — |
Return Type
UE::Slate::FDeprecateVector2DResult Example
Convert widget center to absolute space C++
// In an OnPaint override or event handler where MyGeometry is available:
FVector2f Center = FVector2f(MyGeometry.GetLocalSize()) * 0.5f;
FVector2f AbsCenter = FVector2f(MyGeometry.LocalToAbsolute(Center));
UE_LOG(LogTemp, Log, TEXT("Widget center in absolute space: %s"), *AbsCenter.ToString()); See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
| 5.5 | stable | — |
Feedback
Was this helpful?