UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FScrollyZoomy Class Reference

#include <ScrollyZoomy.h>

Public Member Functions

SLATE_API FScrollyZoomy (const bool InUseInertialScrolling=true)
 
SLATE_API void Tick (const float DeltaTime, IScrollableZoomable &ScrollableZoomable)
 
SLATE_API FReply OnMouseButtonDown (const FPointerEvent &MouseEvent)
 
SLATE_API FReply OnMouseButtonUp (const TSharedRef< SWidget > MyWidget, const FGeometry &MyGeometry, const FPointerEvent &MouseEvent)
 
SLATE_API FReply OnMouseMove (const TSharedRef< SWidget > MyWidget, IScrollableZoomable &ScrollableZoomable, const FGeometry &MyGeometry, const FPointerEvent &MouseEvent)
 
SLATE_API void OnMouseLeave (const TSharedRef< SWidget > MyWidget, const FPointerEvent &MouseEvent)
 
SLATE_API FReply OnMouseWheel (const FPointerEvent &MouseEvent, IScrollableZoomable &ScrollableZoomable)
 
SLATE_API FCursorReply OnCursorQuery () const
 
SLATE_API bool IsRightClickScrolling () const
 
SLATE_API bool NeedsSoftwareCursor () const
 
SLATE_API UE::Slate::FDeprecateVector2DResult GetSoftwareCursorPosition () const
 
SLATE_API int32 PaintSoftwareCursorIfNeeded (const FGeometry &AllottedGeometry, const FSlateRect &MyCullingRect, FSlateWindowElementList &OutDrawElements, int32 LayerId) const
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FScrollyZoomy()

FScrollyZoomy::FScrollyZoomy ( const bool  InUseInertialScrolling = true)

Create and initialize a new instance.

Parameters
InUseInertialScrollingWhether inertial scrolling should be used (default = true).

Member Function Documentation

◆ GetSoftwareCursorPosition()

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.

Returns
Cursor position.
See also
NeedsSoftwareCursor

◆ IsRightClickScrolling()

bool FScrollyZoomy::IsRightClickScrolling ( ) const

Whether the user is actively scrolling.

Returns
true if the user is scrolling, false otherwise.

◆ NeedsSoftwareCursor()

bool FScrollyZoomy::NeedsSoftwareCursor ( ) const

Whether a software cursor should be rendered.

This method should be called from your widget's OnPaint function.

Returns
true if a software cursor should be rendered, false otherwise.
See also
GetSoftwareCursorPosition

◆ OnCursorQuery()

FCursorReply FScrollyZoomy::OnCursorQuery ( ) const

Call this from your widget's OnCursorQuery function.

Returns
The cursor reply to pass back.

◆ OnMouseButtonDown()

FReply FScrollyZoomy::OnMouseButtonDown ( const FPointerEvent MouseEvent)

Should be called when a mouse button is pressed.

Parameters
MouseEventThe mouse event passed to a widget's OnMouseButtonDown function.
Returns
If FReply::Handled is returned, that should be passed as the result of the calling function.

◆ OnMouseButtonUp()

FReply FScrollyZoomy::OnMouseButtonUp ( const TSharedRef< SWidget MyWidget,
const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)

Should be called when a mouse button is released.

Parameters
MyWidgetPointer to the widget that owns this object.
MyGeometryGeometry of the widget we're scrolling.
MouseEventThe mouse event passed to a widget's OnMouseButtonUp function.
Returns
If FReply::Handled is returned, that should be passed as the result of the calling function.

◆ OnMouseLeave()

void FScrollyZoomy::OnMouseLeave ( const TSharedRef< SWidget MyWidget,
const FPointerEvent MouseEvent 
)

Should be called from your widget's OnMouseLeave override.

Parameters
MyWidgetPointer to the widget that owns this object.
MouseEventThe mouse leave event that was passed to the widget's OnMouseLeave function.

◆ OnMouseMove()

FReply FScrollyZoomy::OnMouseMove ( const TSharedRef< SWidget MyWidget,
IScrollableZoomable ScrollableZoomable,
const FGeometry MyGeometry,
const FPointerEvent MouseEvent 
)

Should be called when a mouse move event occurs.

Parameters
MyWidgetPointer to the widget that owns this object.
ScrollableZoomableInterface to the widget to scroll/zoom.
MyGeometryGeometry of the widget we're scrolling.
MouseEventThe mouse event passed to a widget's OnMouseMove function.
Returns
If FReply::Handled is returned, that should be passed as the result of the calling function.

◆ OnMouseWheel()

FReply FScrollyZoomy::OnMouseWheel ( const FPointerEvent MouseEvent,
IScrollableZoomable ScrollableZoomable 
)

Should be called by your widget when the mouse wheel is used

Parameters
MouseEventThe event passed to your widget's OnMouseWheel function.
ScrollableZoomableInterface to the widget to scroll/zoom.
Returns
If FReply::Handled is returned, that should be passed as the result of the calling function.

◆ PaintSoftwareCursorIfNeeded()

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

Parameters
AllottedGeometryWidget geometry passed into OnPaint.
MyCullingRectWidget clipping rect passed into OnPaint.
OutDrawElementsThe draw element list.
LayerIdLayer identifier.
Returns
New layer Identifier.

◆ Tick()

void FScrollyZoomy::Tick ( const float  DeltaTime,
IScrollableZoomable ScrollableZoomable 
)

Should be called every frame to update simulation state.

Parameters
DeltaTimeTime that's passed.
ScrollableZoomableInterface to the widget to scroll/zoom.

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