Skip to content

Window contents can sometimes be affected by mouse interaction outside the window #4349

@s-nie

Description

@s-nie

egui version 0.27.2, also present on master

Describe the bug

Interactions outside a window can sometimes interact with elements inside the window if they allocate enough space.

To Reproduce

use eframe::{
    egui::{self, vec2},
    run_native, App,
};

struct TestApp;

impl App for TestApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        ctx.set_debug_on_hover(true);
        egui::Window::new("test")
            .scroll(true)
            .resizable(true)
            .title_bar(false)
            .show(ctx, |ui| {
                let _ = ui.allocate_space(vec2(1000.0, 100.0));
                ui.label("hello");
            });
    }
}

fn main() {
    run_native(
        "Test",
        Default::default(),
        Box::new(|_cc| Ok(Box::new(TestApp))),
    )
    .unwrap();
}

Expected behavior

The drag affects whatever is inside the window.

Screenshots

demo.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is broken

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions