Skip to content

Commit

Permalink
Add helpers <pointerbutton>_down() in PointerState (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
mankinskin authored Aug 15, 2021
1 parent f4af22e commit 6c18332
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions egui/src/input_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,24 @@ impl PointerState {
pub(crate) fn could_any_button_be_click(&self) -> bool {
self.could_be_click
}

/// Is the primary button currently down?
#[inline(always)]
pub fn primary_down(&self) -> bool {
self.button_down(PointerButton::Primary)
}

/// Is the secondary button currently down?
#[inline(always)]
pub fn secondary_down(&self) -> bool {
self.button_down(PointerButton::Secondary)
}

/// Is the middle button currently down?
#[inline(always)]
pub fn middle_down(&self) -> bool {
self.button_down(PointerButton::Middle)
}
}

impl InputState {
Expand Down

0 comments on commit 6c18332

Please sign in to comment.