23#include "guillaume/components/drag_interaction.hpp"
34 if (_dragging == dragging) {
48 const utility::math::Vector2F &position)
50 _lastPosition = position;
70 _onDragStart = handler;
State of a drag gesture on an entity: whether it is in progress, how far the pointer moved since the ...
DragEndHandler getOnDragEndHandler(void) const
Get the callback run when a drag ends.
DragHandler getOnDragHandler(void) const
Get the callback run on each move of a drag.
std::function< void( const utility::math::Vector2F &)> DragHandler
Called on each move.
DragInteraction & setOnDragStartHandler(const DragStartHandler &handler)
Store the callback run when a drag starts.
DragInteraction & setOnDragEndHandler(const DragEndHandler &handler)
Store the callback run when a drag ends.
DragInteraction(void)=default
Construct a component with no drag in progress and no handler.
DragInteraction & setLastPosition(const utility::math::Vector2F &position)
Record the pointer position the next delta is measured from.
DragStartHandler getOnDragStartHandler(void) const
Get the callback run when a drag starts.
bool isDragging(void) const
Check whether a drag is in progress.
utility::math::Vector2F getDelta(void) const
Get the movement of the pointer between the two last motion events of the drag.
DragInteraction & setDelta(const utility::math::Vector2F &delta)
Record the movement of the pointer since the previous motion event.
std::function< void(void)> DragStartHandler
Callback run when a drag starts.
utility::math::Vector2F getLastPosition(void) const
Get the pointer position at the last motion event of the drag.
DragInteraction & setOnDragHandler(const DragHandler &handler)
Store the callback run on each move of a drag.
DragInteraction & setDragging(bool dragging)
Record whether a drag is in progress.
std::function< void(void)> DragEndHandler
Callback run when a drag ends.
void setHasChanged(bool hasChanged)
Raise or lower the changed flag.
State. Every class here is plain data attached to an entity.