Struct egui::memory::InteractionState
source · pub(crate) struct InteractionState {
pub potential_click_id: Option<Id>,
pub potential_drag_id: Option<Id>,
}
Expand description
The state of the interaction in egui, i.e. what is being dragged.
Say there is a button in a scroll area.
If the user clicks the button, the button should click.
If the user drags the button we should scroll the scroll area.
So what we do is that when the mouse is pressed we register both the button
and the scroll area (as click_id
/drag_id
).
If the user releases the button without moving the mouse we register it as a click on click_id
.
If the cursor moves too much we clear the click_id
and start passing move events to drag_id
.
Fields§
§potential_click_id: Option<Id>
A widget interested in clicks that has a mouse press on it.
potential_drag_id: Option<Id>
A widget interested in drags that has a mouse press on it.
Note that this is set as soon as the mouse is pressed, so the widget may not yet be marked as “dragged”, as that can only happen after the mouse has moved a bit (at least if the widget is interesated in both clicks and drags).
Implementations§
source§impl InteractionState
impl InteractionState
sourcepub fn is_using_pointer(&self) -> bool
pub fn is_using_pointer(&self) -> bool
Are we currently clicking or dragging an egui widget?
Trait Implementations§
source§impl Clone for InteractionState
impl Clone for InteractionState
source§fn clone(&self) -> InteractionState
fn clone(&self) -> InteractionState
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more