Utility class that adds scrolling and zooming functionality to a widget. 更多...
#include <ScrollyZoomy.h>
Public 成员函数 | |
| FScrollyZoomy (const bool InUseInertialScrolling=true) | |
| Create and initialize a new instance. 更多... | |
| const FVector2D & | GetSoftwareCursorPosition () const |
| Get the position of the software cursor (when NeedsSoftwareCursor is true). 更多... | |
| bool | IsRightClickScrolling () const |
| Whether the user is actively scrolling. 更多... | |
| bool | NeedsSoftwareCursor () const |
| Whether a software cursor should be rendered. 更多... | |
| FCursorReply | OnCursorQuery () const |
| Call this from your widget's OnCursorQuery function. 更多... | |
| FReply | OnMouseButtonDown (const FPointerEvent &MouseEvent) |
| Should be called when a mouse button is pressed. 更多... | |
| FReply | OnMouseButtonUp (const TSharedRef< SWidget > MyWidget, const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) |
| Should be called when a mouse button is released. 更多... | |
| void | OnMouseLeave (const TSharedRef< SWidget > MyWidget, const FPointerEvent &MouseEvent) |
| Should be called from your widget's OnMouseLeave override. 更多... | |
| FReply | OnMouseMove (const TSharedRef< SWidget > MyWidget, IScrollableZoomable &ScrollableZoomable, const FGeometry &MyGeometry, const FPointerEvent &MouseEvent) |
| Should be called when a mouse move event occurs. 更多... | |
| FReply | OnMouseWheel (const FPointerEvent &MouseEvent, IScrollableZoomable &ScrollableZoomable) |
| Should be called by your widget when the mouse wheel is used 更多... | |
| int32 | 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 更多... | |
| void | Tick (const float DeltaTime, IScrollableZoomable &ScrollableZoomable) |
| Should be called every frame to update simulation state. 更多... | |
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.
| FScrollyZoomy::FScrollyZoomy | ( | const bool | InUseInertialScrolling = true | ) |
Create and initialize a new instance.
| InUseInertialScrolling | Whether inertial scrolling should be used (default = true). |
| const FVector2D & 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. |