![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <ScrollyZoomy.h>
Utility class that adds scrolling and zooming functionality to a widget.
Derived your widget class from IScrollableZoomable, then embed an instance of FScrollyZoomy as a widget member variable, and call this class's event handlers from your own widget's event handler callbacks.
Create and initialize a new instance.
| InUseInertialScrolling | Whether inertial scrolling should be used (default = true). |
| UE::Slate::FDeprecateVector2DResult FScrollyZoomy::GetSoftwareCursorPosition | ( | ) | const |
Get the position of the software cursor (when NeedsSoftwareCursor is true).
This method should be called from your widget's OnPaint function.
| bool FScrollyZoomy::IsRightClickScrolling | ( | ) | const |
Whether the user is actively scrolling.
| bool FScrollyZoomy::NeedsSoftwareCursor | ( | ) | const |
Whether a software cursor should be rendered.
This method should be called from your widget's OnPaint function.
| FCursorReply FScrollyZoomy::OnCursorQuery | ( | ) | const |
Call this from your widget's OnCursorQuery function.
| FReply FScrollyZoomy::OnMouseButtonDown | ( | const FPointerEvent & | MouseEvent | ) |
Should be called when a mouse button is pressed.
| MouseEvent | The mouse event passed to a widget's OnMouseButtonDown function. |
| FReply FScrollyZoomy::OnMouseButtonUp | ( | const TSharedRef< SWidget > | MyWidget, |
| const FGeometry & | MyGeometry, | ||
| const FPointerEvent & | MouseEvent | ||
| ) |
Should be called when a mouse button is released.
| MyWidget | Pointer to the widget that owns this object. |
| MyGeometry | Geometry of the widget we're scrolling. |
| MouseEvent | The mouse event passed to a widget's OnMouseButtonUp function. |
| void FScrollyZoomy::OnMouseLeave | ( | const TSharedRef< SWidget > | MyWidget, |
| const FPointerEvent & | MouseEvent | ||
| ) |
Should be called from your widget's OnMouseLeave override.
| MyWidget | Pointer to the widget that owns this object. |
| MouseEvent | The mouse leave event that was passed to the widget's OnMouseLeave function. |
| FReply FScrollyZoomy::OnMouseMove | ( | const TSharedRef< SWidget > | MyWidget, |
| IScrollableZoomable & | ScrollableZoomable, | ||
| const FGeometry & | MyGeometry, | ||
| const FPointerEvent & | MouseEvent | ||
| ) |
Should be called when a mouse move event occurs.
| MyWidget | Pointer to the widget that owns this object. |
| ScrollableZoomable | Interface to the widget to scroll/zoom. |
| MyGeometry | Geometry of the widget we're scrolling. |
| MouseEvent | The mouse event passed to a widget's OnMouseMove function. |
| FReply FScrollyZoomy::OnMouseWheel | ( | const FPointerEvent & | MouseEvent, |
| IScrollableZoomable & | ScrollableZoomable | ||
| ) |
Should be called by your widget when the mouse wheel is used
| MouseEvent | The event passed to your widget's OnMouseWheel function. |
| ScrollableZoomable | Interface to the widget to scroll/zoom. |
| int32 FScrollyZoomy::PaintSoftwareCursorIfNeeded | ( | const FGeometry & | AllottedGeometry, |
| const FSlateRect & | MyCullingRect, | ||
| FSlateWindowElementList & | OutDrawElements, | ||
| int32 | LayerId | ||
| ) | const |
Call this from your widget's OnPaint to paint a software cursor, if needed
| AllottedGeometry | Widget geometry passed into OnPaint. |
| MyCullingRect | Widget clipping rect passed into OnPaint. |
| OutDrawElements | The draw element list. |
| LayerId | Layer identifier. |
| void FScrollyZoomy::Tick | ( | const float | DeltaTime, |
| IScrollableZoomable & | ScrollableZoomable | ||
| ) |
Should be called every frame to update simulation state.
| DeltaTime | Time that's passed. |
| ScrollableZoomable | Interface to the widget to scroll/zoom. |