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.
Therefore, 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 moresource§impl Debug for InteractionState
impl Debug for InteractionState
source§impl Default for InteractionState
impl Default for InteractionState
source§fn default() -> InteractionState
fn default() -> InteractionState
Auto Trait Implementations§
impl Freeze for InteractionState
impl RefUnwindSafe for InteractionState
impl Send for InteractionState
impl Sync for InteractionState
impl Unpin for InteractionState
impl UnwindSafe for InteractionState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)