Using leafwing-input-manager for mouse click input, a significant fraction of my trackpad taps get ignored. I.e. the just_pressed() function seems to never return true for some clicks. This does not happen when I physically click the touchpad.
I believe this is due to the fact that the tap creates a press and release event simultaneously, ie just_pressed and just_released of bevy_input are true in the same frame, as the following logs show. Therefore I assume you clear the pressed state again before any schedule has time to read it. For the sake of the user experience I think it would be nicer if the pressed state would be forced to last for at least one frame/update.
Additional information / logs
I ran the following system:
fn log_clicks(
frame: Res<bevy::core::FrameCount>,
leafwing: Res<ActionState<Action>>,
bevy: Res<ButtonInput<MouseButton>>,
) {
if leafwing.just_pressed(&Action::Build) {
debug!("{frame:?} leafwing click");
}
if leafwing.just_released(&Action::Build) {
debug!("{frame:?} leafwing release");
}
if bevy.just_pressed(MouseButton::Left) {
debug!("{frame:?} bevy click");
}
if bevy.just_released(MouseButton::Left) {
debug!("{frame:?} bevy release");
}
}
with the Action::Build being mapped to (Self::Build, Single(Mouse(MouseButton::Left)))
Relevant system information
Description
Using leafwing-input-manager for mouse click input, a significant fraction of my trackpad taps get ignored. I.e. the just_pressed() function seems to never return true for some clicks. This does not happen when I physically click the touchpad.
I believe this is due to the fact that the tap creates a press and release event simultaneously, ie
just_pressed
andjust_released
of bevy_input are true in the same frame, as the following logs show. Therefore I assume you clear the pressed state again before any schedule has time to read it. For the sake of the user experience I think it would be nicer if the pressed state would be forced to last for at least one frame/update.Additional information / logs
I ran the following system:
with the
Action::Build
being mapped to(Self::Build, Single(Mouse(MouseButton::Left)))
And got the following (shortened) output:
Even more information
I have also run the pump_events example of winit, which logs all events every 16ms and got interesting results:
Sometimes when I tap, no Update or RedrawRequested event are logged between the pressed and released:
Sometimes there is a single update between the two tap events:
And for comparison, here is how it looks when I casually press the touchpad instead of tapping.