Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sticky shift key #232

Closed
doonv opened this issue Nov 27, 2023 · 4 comments · Fixed by #298
Closed

Sticky shift key #232

doonv opened this issue Nov 27, 2023 · 4 comments · Fixed by #298

Comments

@doonv
Copy link

doonv commented Nov 27, 2023

The bug

Pressing the Shift key once causes it to remain pressed after releasing it. This usually doesn't affect anything but it does effect ScrollArea scrolling, which forces horizontal scrolling after Shift was pressed.

Example

use bevy::prelude::*;
use bevy_egui::{egui, EguiContexts, EguiPlugin};

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(EguiPlugin)
        // Systems that create Egui widgets should be run during the `CoreSet::Update` set,
        // or after the `EguiSet::BeginFrame` system (which belongs to the `CoreSet::PreUpdate` set).
        .add_systems(Update, ui_example_system)
        .run();
}

fn ui_example_system(mut contexts: EguiContexts) {
    egui::Window::new("Hello").show(contexts.ctx_mut(), |ui| {
        let pressed = ui.input(|i| i.modifiers.shift);
        info!("pressed? {pressed}");
        ui.label("world");
    });
}

It will start out printing pressed? false. But after tapping Shift it will only print pressed? true

@doonv
Copy link
Author

doonv commented Nov 27, 2023

Wait no it looks like it's a bevy problem?

@doonv
Copy link
Author

doonv commented Nov 27, 2023

Yeah it's a bevy problem. Should be fixed by bevyengine/bevy#10702.

@doonv doonv closed this as not planned Won't fix, can't repro, duplicate, stale Nov 27, 2023
@doonv
Copy link
Author

doonv commented May 24, 2024

Update: It was not fixed. This problem is still occurring to me in bevy_egui 0.27.0, Bevy's ButtonInput<KeyCode>::pressed(KeyCode::ShiftLeft) returns correct values.

@SludgePhD
Copy link
Contributor

I opened a PR with a fix in #298

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants