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

Wrong handling of menu by list of custom_menu_button #5498

Closed
abey79 opened this issue Dec 17, 2024 · 0 comments · Fixed by #5555
Closed

Wrong handling of menu by list of custom_menu_button #5498

abey79 opened this issue Dec 17, 2024 · 0 comments · Fixed by #5555
Labels
bug Something is broken egui rerun Desired for Rerun.io

Comments

@abey79
Copy link
Collaborator

abey79 commented Dec 17, 2024

When multiple custom_menu_button are vertically aligned and close together, going in one button's menu auto-switch to the menu of the next one instead of letting me interact with the menu's content:

custom-menu-bug.mp4

Repro

#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
#![allow(rustdoc::missing_crate_level_docs)] // it's an example

use eframe::egui;

fn main() -> eframe::Result {
    env_logger::init(); // Log to stderr (if you run with `RUST_LOG=debug`).

    let options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]),
        ..Default::default()
    };

    eframe::run_simple_native("My egui App", options, move |ctx, _frame| {
        egui::CentralPanel::default().show(ctx, |ui| {
            egui::menu::menu_custom_button(ui, egui::Button::new("BTN"), |ui| {
                ui.button("Hello world");
            });
            egui::menu::menu_custom_button(ui, egui::Button::new("BTN"), |ui| {
                ui.button("Hello world");
            });
        });
    })
}

Step:

  1. click on the top button
  2. attempt to click on the "hello world" button in the menu

Expected: the menu stays open so I can interact with its content
Actual: the menu of the next button shows up by mere moving of the mouse cursor

@abey79 abey79 added bug Something is broken egui rerun Desired for Rerun.io labels Dec 17, 2024
@abey79 abey79 added this to the Next Patch Release milestone Dec 17, 2024
emilk added a commit that referenced this issue Jan 22, 2025
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

This change discards widgets which are fully covered by another widget
in a higher layer from the hit test algorithm.

* Closes <#5498>
* [x] I have followed the instructions in the PR template

---------

Co-authored-by: Emil Ernerfeldt <[email protected]>
@github-project-automation github-project-automation bot moved this to Done in egui Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken egui rerun Desired for Rerun.io
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant