Skip to content

Commit

Permalink
added clean_button_state to stop propagation of mouse events
Browse files Browse the repository at this point in the history
  • Loading branch information
Nazariglez committed Apr 25, 2024
1 parent 4c74509 commit 294c9b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crates/notan_input/src/mouse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ impl Mouse {
self.moving
}

/// Cleans the state of a button (useful for stop propagation)
pub fn clean_button_state(&mut self, btn: MouseButton) {
self.pressed.remove(&btn);
self.down.remove(&btn);
self.released.remove(&btn);
}

#[inline]
pub(crate) fn clear(&mut self) {
self.pressed.clear();
Expand Down

0 comments on commit 294c9b4

Please sign in to comment.