diff --git a/crates/egui/src/input_state/mod.rs b/crates/egui/src/input_state/mod.rs index dc07ffeb7..55c76bb06 100644 --- a/crates/egui/src/input_state/mod.rs +++ b/crates/egui/src/input_state/mod.rs @@ -1419,6 +1419,9 @@ impl PointerState { /// Was the given pointer button given clicked this frame? /// + /// A click is registered when the mouse or touch is released within + /// a certain amount of time and distance from when and where it was pressed. + /// /// Returns true on double- and triple- clicks too. pub fn button_clicked(&self, button: PointerButton) -> bool { self.pointer_events @@ -1453,11 +1456,17 @@ impl PointerState { } /// Was the primary button clicked this frame? + /// + /// A click is registered when the mouse or touch is released within + /// a certain amount of time and distance from when and where it was pressed. pub fn primary_clicked(&self) -> bool { self.button_clicked(PointerButton::Primary) } /// Was the secondary button clicked this frame? + /// + /// A click is registered when the mouse or touch is released within + /// a certain amount of time and distance from when and where it was pressed. pub fn secondary_clicked(&self) -> bool { self.button_clicked(PointerButton::Secondary) } diff --git a/crates/egui/src/response.rs b/crates/egui/src/response.rs index 54d53f2b4..81d04f1ef 100644 --- a/crates/egui/src/response.rs +++ b/crates/egui/src/response.rs @@ -199,6 +199,12 @@ impl Response { /// Returns true if this widget was clicked this frame by the secondary mouse button (e.g. the right mouse button). /// + /// A click is registered when the mouse or touch is released within + /// a certain amount of time and distance from when and where it was pressed. + /// + /// Note that the widget must be sensing clicks with [`Sense::click`]. + /// [`crate::Button`] senses clicks; [`crate::Label`] does not (unless you call [`crate::Label::sense`]). + /// /// This also returns true if the widget was pressed-and-held on a touch screen. #[inline] pub fn secondary_clicked(&self) -> bool { @@ -214,6 +220,12 @@ impl Response { } /// Returns true if this widget was clicked this frame by the middle mouse button. + /// + /// A click is registered when the mouse or touch is released within + /// a certain amount of time and distance from when and where it was pressed. + /// + /// Note that the widget must be sensing clicks with [`Sense::click`]. + /// [`crate::Button`] senses clicks; [`crate::Label`] does not (unless you call [`crate::Label::sense`]). #[inline] pub fn middle_clicked(&self) -> bool { self.clicked_by(PointerButton::Middle)