One press that may become a drag, with what every control does around it: the focus and the capture on the press, the value the drag changes kept as it was, put back on Escape and left for the commit after the release.
More...
|
| bool | IsHeld () const noexcept |
| bool | IsPressed (ID element) const noexcept |
| bool | IsDragging (ID element) const noexcept |
| GesturePhase | Phase () const noexcept |
| bool | Press (const ElementEvent &e, const ElementStorage &storage, GUIStateManager &gsm, Snapshot snapshot={}, const PressOptions &options={}) |
| | Starts on e when it is the options' button going down: keeps snapshot, takes the focus and the capture as the options say.
|
| bool | Move (const ElementEvent &e, int32_t distance) |
| | See PointerDrag::Move.
|
| PointerDrag::Ended | Release (const ElementEvent &e) |
| | See PointerDrag::Release. before stays for the commit.
|
| void | Reset () |
| | Drops any press and what it kept (the control was disabled under it, say).
|
| bool | Cancel (const ElementEvent &e, GUIStateManager &gsm) |
| | Escape on the pressed element: drops the press and its capture.
|
| bool | Cancel (const ElementEvent &e, GUIStateManager &gsm, Snapshot &value) |
| | Escape on the pressed element: as Cancel, and value is put back as it was.
|
template<class Snapshot = NoSnapshot>
struct tachyon::Gesture< Snapshot >
One press that may become a drag, with what every control does around it: the focus and the capture on the press, the value the drag changes kept as it was, put back on Escape and left for the commit after the release.
The phases nest in the element's hover (InteractionState): hovered, then pressed, then dragging, ending as a click, a drag or a cancel.
Gesture<float> drag; // in the control's state
case MouseDown: return drag.Press(e, storage, gsm, value);
case MouseMove: if (drag.Move(e, distance)) value = ...; return true;
case MouseUp: if (drag.Release(e) == PointerDrag::Ended::Drag) Commit(drag.before, value);
case KeyDown: return drag.Cancel(e, gsm, value);