class new in Git master
#include <Magnum/Ui/Event.h>
ScrollEvent Scroll event.
Constructors, destructors, conversion operators
- ScrollEvent(Nanoseconds time, const Vector2& offset) explicit
- Constructor.
Public functions
- auto time() const -> Nanoseconds
- Time at which the event happened.
- auto offset() const -> Vector2
- Scroll offset.
- auto position() const -> Vector2
- Event position.
- auto nodeSize() const -> Vector2
- Size of the node the event is called on.
- auto isNodePressed() const -> bool
- Whether the event is called on a node that's currently pressed.
- auto isNodeHovered() const -> bool
- Whether the event is called on a node that's currently hovered.
- auto isNodeFocused() const -> bool
- Whether the event is called on a node that's currently focused.
- auto isCaptured() const -> bool
- Whether the event is captured on a node.
- auto isAccepted() const -> bool
- Whether the event is accepted.
- void setAccepted(bool accepted = true)
- Set the event as accepted.
Function documentation
Magnum:: Ui:: ScrollEvent:: ScrollEvent(Nanoseconds time,
const Vector2& offset) explicit
Constructor.
Parameters | |
---|---|
time | Time at which the event happened |
offset | Scroll offset in steps, where 1.0f is equivalent to one tick of a mouse scroll wheel, and right and up direction is positive |
The time
may get used for UI animations. A default-constructed value causes an animation play time to be in the past, thus immediately transitioning to a stopped state. The position and node-related properties are set from AbstractUserInterface event handler internals.
Vector2 Magnum:: Ui:: ScrollEvent:: offset() const
Scroll offset.
Note that unlike position(), the offset is not in UI units, but rather scroll steps, where 1.0f
usually maps to one tick of a mouse scroll wheel, with right and up being positive. Depending on desktop UI scaling, browser zoom factor and system settings the offset may also be a fractional value, and even with a magnitude less than one. Which means a plain integer conversion may result in it being zero.
Vector2 Magnum:: Ui:: ScrollEvent:: position() const
Event position.
Relative to top left corner of the node the event is called on. Use nodeSize() to calculate a position relative to the node size or to other edges / corners. If the position has any coordinate less than 0.0f
or greater or equal to nodeSize(), the event was called outside of the node area, for example when a pointer is released outside of a captured node.
bool Magnum:: Ui:: ScrollEvent:: isNodePressed() const
Whether the event is called on a node that's currently pressed.
Returns true
if AbstractUserInterface::false
otherwise.
bool Magnum:: Ui:: ScrollEvent:: isNodeHovered() const
Whether the event is called on a node that's currently hovered.
Returns true
if AbstractUserInterface::false
otherwise.
bool Magnum:: Ui:: ScrollEvent:: isNodeFocused() const
Whether the event is called on a node that's currently focused.
Returns true
if AbstractUserInterface::false
otherwise. Unlike isNodeHovered(), returns true
also if the actual pointer position is outside of the area of the node the event is called on, for example in case of an event capture.
bool Magnum:: Ui:: ScrollEvent:: isCaptured() const
Whether the event is captured on a node.
If the event is called on a AbstractUserInterface::false
. Otherwise returns true
if AbstractUserInterface::false
otherwise. Unlike PointerEvent or PointerMoveEvent, scroll events don't have a possibility to modify the captured status.
void Magnum:: Ui:: ScrollEvent:: setAccepted(bool accepted = true)
Set the event as accepted.
Once an event is accepted, it doesn't propagate further.