pub enum MouseClickingStrategy {
Pressed,
NotPressed,
FallingEdge,
RisingEdge,
DoubleEdge {
rising_edge: bool,
},
RisingHold {
rising_edge: bool,
time: f32,
goal: f32,
},
Hold {
time: f32,
goal: f32,
},
}Expand description
Determines when MouseButtonManager::is_clicked returns true.
Each variant tracks button state through an internal edge detector. All
variants respect the manager’s cooldown: while cooldown > 0,
is_clicked() always returns false and button presses are ignored.
After handling a click, call MouseButtonManager::change_cooldown to
set a debounce duration; the cooldown does not restart automatically.
§Variants
| Variant | is_clicked when |
|---|---|
Pressed | Button is gated-pressed this frame |
NotPressed | Button is not gated-pressed |
FallingEdge | Falling edge of gated press (release) |
RisingEdge | Rising edge of gated press (initial press) |
DoubleEdge | Release after a valid press-while-hovered sequence |
RisingHold | Hold timer reaches goal while armed |
Hold | Hold timer reaches goal while pressed and hovered |
Variants§
Pressed
is_clicked is true while the button is held (after cooldown).
NotPressed
is_clicked is true while the button is not held (after cooldown).
FallingEdge
is_clicked is true on the frame the button is released.
RisingEdge
is_clicked is true on the frame the button is first pressed.
DoubleEdge
Click-on-release after a press-while-hovered sequence.
During a press, rising_edge is armed when hovered and cooldown has
expired. is_clicked fires on the release (falling edge) when armed.
§Note
This is not an operating-system double-click detector.
RisingHold
Fires when time >= goal after the same arming logic as DoubleEdge.
While armed, time increases each frame; when not armed, time decreases.
time resets to zero when the button is released.
Fields
Hold
Fires when time >= goal while the button is held and the element is hovered.
time resets to zero when the button is released or the cursor leaves
the hover region.