class new in Git master
#include <Magnum/Ui/Event.h>
PointerMoveEvent Pointer move event.
Constructors, destructors, conversion operators
-
PointerMoveEvent(Nanoseconds time,
PointerEventSource source,
Containers::
Optional<Pointer> pointer, Pointers pointers, bool primary, Long id) explicit - Constructor.
-
PointerMoveEvent(Nanoseconds time,
PointerEventSource source,
Containers::
Optional<Pointer> pointer, Pointers pointers, bool primary, Long id, const Vector2& relativePosition) explicit - Constructor.
Public functions
- auto time() const -> Nanoseconds
- Time at which the event happened.
- auto isFallthrough() const -> bool
- Whether it's a fallthrough event.
- auto source() const -> PointerEventSource
- Pointer event source.
-
auto pointer() const -> Containers::
Optional<Pointer> - Pointer type that was added or removed from the set of pressed pointers.
- auto pointers() const -> Pointers
- Pointer types pressed in this event.
- auto isPrimary() const -> bool
- Whether the pointer is primary.
- auto id() const -> Long
- Pointer ID.
- auto position() const -> Vector2
- Event position.
- auto relativePosition() const -> Vector2
- Position relative to previous pointer event.
- 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 hovered.
- 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.
- void setCaptured(bool captured)
- Set whether to capture the event 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:: PointerMoveEvent:: PointerMoveEvent(Nanoseconds time,
PointerEventSource source,
Containers:: Optional<Pointer> pointer,
Pointers pointers,
bool primary,
Long id) explicit
Constructor.
Parameters | |
---|---|
time | Time at which the event happened |
source | Pointer event source |
pointer | Pointer type that changed in this event or Containers:: |
pointers | Pointer types pressed in this event |
primary | Whether the pointer is primary |
id | Pointer ID |
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 pointer
is expected to match source
or be Containers::primary
is expected to be true
for PointerEventSource::
Magnum:: Ui:: PointerMoveEvent:: PointerMoveEvent(Nanoseconds time,
PointerEventSource source,
Containers:: Optional<Pointer> pointer,
Pointers pointers,
bool primary,
Long id,
const Vector2& relativePosition) explicit
Constructor.
Meant to be used for testing purposes. The relativePosition
gets overwritten in AbstractUserInterface event handler internals.
bool Magnum:: Ui:: PointerMoveEvent:: isFallthrough() const
Whether it's a fallthrough event.
Fallthrough events are sent to nodes with NodeFlag::true
, isNodePressed(), isNodeHovered(), isNodeFocused() and isCaptured() refer to the child node the original event was called on.
Accepting a primary fallthrough event causes a AbstractLayer::
Accepting a secondary fallthrough event causes a AbstractLayer::
PointerEventSource Magnum:: Ui:: PointerMoveEvent:: source() const
Pointer event source.
Containers:: Optional<Pointer> Magnum:: Ui:: PointerMoveEvent:: pointer() const
Pointer type that was added or removed from the set of pressed pointers.
Is non-empty only in case a mouse button was pressed in addition to an already pressed button, or if one mouse button from multiple pressed buttons was released. If non-empty and pointers() don't contain given Pointer value, the button was released, if it contains given value, the button was pressed.
bool Magnum:: Ui:: PointerMoveEvent:: isPrimary() const
Whether the pointer is primary.
Used to distinguish among multiple pointers in a multi-touch scenario. Events coming from PointerEventSource::
Long Magnum:: Ui:: PointerMoveEvent:: id() const
Pointer ID.
Used to distinguish among multiple pointers in a multi-touch scenario. Events coming from PointerEventSource::
Vector2 Magnum:: Ui:: PointerMoveEvent:: 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 dragged outside of a captured node.
Vector2 Magnum:: Ui:: PointerMoveEvent:: relativePosition() const
Position relative to previous pointer event.
Relative to the previous primary pointer event. If no primary pointer event happened before, is a zero vector. For pointer enter and leave events it's a zero vector always, as they happen immediately after another event.
Non-primary events don't track relative position at the moment and return a zero vector as well, as it'd mean the implementation would internally have to track a potentially unbounded number of independent finger positions.
bool Magnum:: Ui:: PointerMoveEvent:: isNodePressed() const
Whether the event is called on a node that's currently hovered.
Returns true
if AbstractUserInterface::false
otherwise. In particular, is true
also for a move that happens outside of a pressed and captured node.
bool Magnum:: Ui:: PointerMoveEvent:: isNodeHovered() const
Whether the event is called on a node that's currently hovered.
Returns true
if AbstractUserInterface::false
otherwise. In particular, is false
for the first move event happening on a node, true
for the enter event and all subsequent accepted move events on the same node, false
for the leave event. On a captured move event returns false
for if the pointer was moved outside of the node area.
Note that even if this function returns true
, the event handler still controls whether the node actually appears in AbstractUserInterface::false
.
bool Magnum:: Ui:: PointerMoveEvent:: 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:: PointerMoveEvent:: isCaptured() const
Whether the event is captured on a node.
Is implicitly true
if AbstractUserInterface::false
otherwise, unless a previously called event handler modified the capture.
void Magnum:: Ui:: PointerMoveEvent:: setCaptured(bool captured)
Set whether to capture the event on a node.
By default, after a press event of a primary pointer, a node captures all following pointer and key events until and including a release of the primary pointer, even if they happen outside of the node area. If capture is disabled, the events are always sent to the actual node under the pointer.
The capture can be both disabled and enabled again for all pointer move, enter and leave events, each time it's enabled again it'll capture the actual node under the pointer. Calling this function has no effect on a pointer leave event that isn't captured.
bool Magnum:: Ui:: PointerMoveEvent:: isAccepted() const
Whether the event is accepted.
Implicitly false
.
void Magnum:: Ui:: PointerMoveEvent:: setAccepted(bool accepted = true)
Set the event as accepted.
Once an event is accepted, it doesn't propagate further. It may however still fall through to parent nodes marked with NodeFlag::