Constrain menus to the screen

This commit is contained in:
Emil Ernerfeldt 2023-01-26 11:13:21 +01:00
parent 8ce0e1c520
commit 5b1cad2b72
2 changed files with 3 additions and 1 deletions

View file

@ -35,6 +35,7 @@ NOTE: [`epaint`](crates/epaint/CHANGELOG.md), [`eframe`](crates/eframe/CHANGELOG
* Don't render `\r` (Carriage Return) ([#2452](https://github.com/emilk/egui/pull/2452)). * Don't render `\r` (Carriage Return) ([#2452](https://github.com/emilk/egui/pull/2452)).
* The `button_padding` style option works closer as expected with image+text buttons now ([#2510](https://github.com/emilk/egui/pull/2510)). * The `button_padding` style option works closer as expected with image+text buttons now ([#2510](https://github.com/emilk/egui/pull/2510)).
* Fixed rendering of `…` (ellipsis). * Fixed rendering of `…` (ellipsis).
* Menus are now moved to fit on the screen.
## 0.20.1 - 2022-12-11 - Fix key-repeat ## 0.20.1 - 2022-12-11 - Fix key-repeat

View file

@ -143,9 +143,10 @@ pub(crate) fn menu_ui<'c, R>(
let area = Area::new(menu_id) let area = Area::new(menu_id)
.order(Order::Foreground) .order(Order::Foreground)
.constrain(true)
.fixed_pos(pos) .fixed_pos(pos)
.interactable(true) .interactable(true)
.drag_bounds(Rect::EVERYTHING); .drag_bounds(ctx.screen_rect());
let inner_response = area.show(ctx, |ui| { let inner_response = area.show(ctx, |ui| {
set_menu_style(ui.style_mut()); set_menu_style(ui.style_mut());