|
TachyonUI 0.1.0
High-performance UI for building tools.
|
One press on an element that may become a drag. More...
#include <gui_core/input/gui_pointer_drag.h>
Public Types | |
| enum class | Ended : uint8_t { No , Click , Drag } |
| How a press ended. More... | |
Public Member Functions | |
| bool | IsHeld () const noexcept |
| A press is held, on any element. | |
| bool | IsPressed (ID element) const noexcept |
| A press of element is held. | |
| bool | IsDragging (ID element) const noexcept |
| A press of element is held and has become a drag. | |
| bool | Press (const ElementEvent &e, const ElementStorage &storage, MouseButtons button=MouseButtons::Left, bool atOnce=false) |
| Starts tracking e when it is button going down: true then. | |
| bool | Move (const ElementEvent &e, int32_t distance) |
| For a move of the held press: true when it is a drag move, the one that goes past distance pixels (see IsDragTravel) included. | |
| Ended | Release (const ElementEvent &e) |
| For the held button coming up on e.id: how the press ended. There is no press after. | |
| bool | Cancel (ID element) noexcept |
| Drops the press of element (Escape, a lost capture): true when there was one. | |
| void | Reset () noexcept |
| Drops any press. | |
| int2 | ScreenDelta (const InputState &s) const noexcept |
| Pointer travel since the press, in screen pixels. | |
| int2 | LocalDelta (const ElementEvent &e, const ElementStorage &storage) const |
| Pointer travel since the press, in the space of the element's rect (follows zoom). | |
Public Attributes | |
| ID | id = ID::Invalid() |
| the element pressed; Invalid when there is no press | |
| MouseButtons | button = MouseButtons::None |
| the button held | |
| int2 | pressScreen { 0, 0 } |
| pointer at the press, screen pixels | |
| int2 | pressLocal { 0, 0 } |
| pointer at the press, in the space of the element's rect | |
| bool | dragging = false |
| moved the drag distance (or a drag from the press on) | |
One press on an element that may become a drag.
A control keeps it in its own state and gives it that element's events: Press when a button goes down, Move on each move, Release when the button comes up and Cancel on Escape. What the drag changes, and the value to put back on a cancel, stay with the control.
The element that returns true for the press gets the mouse capture, so the moves and the release come to it wherever the pointer goes.
|
strong |
|
inlinenoexcept |
A press is held, on any element.
|
inlinenoexcept |
A press of element is held.
|
inlinenoexcept |
A press of element is held and has become a drag.
| bool tachyon::PointerDrag::Press | ( | const ElementEvent & | e, |
| const ElementStorage & | storage, | ||
| MouseButtons | button = MouseButtons::Left, | ||
| bool | atOnce = false ) |
Starts tracking e when it is button going down: true then.
With atOnce the press is a drag from the start (a sizer, a scrollbar thumb) and never a click.
| bool tachyon::PointerDrag::Move | ( | const ElementEvent & | e, |
| int32_t | distance ) |
For a move of the held press: true when it is a drag move, the one that goes past distance pixels (see IsDragTravel) included.
False for another element, without a press, or while the press is still under the distance.
| Ended tachyon::PointerDrag::Release | ( | const ElementEvent & | e | ) |
For the held button coming up on e.id: how the press ended. There is no press after.
|
noexcept |
Drops the press of element (Escape, a lost capture): true when there was one.
|
inlinenoexcept |
Drops any press.
|
inlinenoexcept |
Pointer travel since the press, in screen pixels.
| int2 tachyon::PointerDrag::LocalDelta | ( | const ElementEvent & | e, |
| const ElementStorage & | storage ) const |
Pointer travel since the press, in the space of the element's rect (follows zoom).
| ID tachyon::PointerDrag::id = ID::Invalid() |
the element pressed; Invalid when there is no press
| MouseButtons tachyon::PointerDrag::button = MouseButtons::None |
the button held
| int2 tachyon::PointerDrag::pressScreen { 0, 0 } |
pointer at the press, screen pixels
| int2 tachyon::PointerDrag::pressLocal { 0, 0 } |
pointer at the press, in the space of the element's rect
| bool tachyon::PointerDrag::dragging = false |
moved the drag distance (or a drag from the press on)