Don't clip popups to the parent cliprect (#885)

Closes https://github.com/emilk/egui/issues/825
This commit is contained in:
Emil Ernerfeldt 2021-11-07 19:48:38 +01:00 committed by GitHub
parent 878eddd546
commit 19d24bbebe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -20,6 +20,9 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
* Replace `Ui::__test` with `egui::__run_test_ui` ([#872](https://github.com/emilk/egui/pull/872)). * Replace `Ui::__test` with `egui::__run_test_ui` ([#872](https://github.com/emilk/egui/pull/872)).
* Replace `scroll_delta` and `zoom_delta` in `RawInput` with `Event::Scroll` and `Event::Zoom`. * Replace `scroll_delta` and `zoom_delta` in `RawInput` with `Event::Scroll` and `Event::Zoom`.
### Fixed 🐛
* Fix `ComboBox` and other popups getting clipped to parent window ([#885](https://github.com/emilk/egui/pull/885)).
### Removed 🔥 ### Removed 🔥
* Removed `egui::math` (use `egui::emath` instead). * Removed `egui::math` (use `egui::emath` instead).
* Removed `egui::paint` (use `egui::epaint` instead). * Removed `egui::paint` (use `egui::epaint` instead).

View file

@ -287,13 +287,12 @@ pub fn popup_below_widget<R>(
add_contents: impl FnOnce(&mut Ui) -> R, add_contents: impl FnOnce(&mut Ui) -> R,
) -> Option<R> { ) -> Option<R> {
if ui.memory().is_popup_open(popup_id) { if ui.memory().is_popup_open(popup_id) {
let parent_clip_rect = ui.clip_rect();
let inner = Area::new(popup_id) let inner = Area::new(popup_id)
.order(Order::Foreground) .order(Order::Foreground)
.fixed_pos(widget_response.rect.left_bottom()) .fixed_pos(widget_response.rect.left_bottom())
.show(ui.ctx(), |ui| { .show(ui.ctx(), |ui| {
ui.set_clip_rect(parent_clip_rect); // for when the combo-box is in a scroll area. // Note: we use a separate clip-rect for this area, so the popup can be outside the parent.
// See https://github.com/emilk/egui/issues/825
let frame = Frame::popup(ui.style()); let frame = Frame::popup(ui.style());
let frame_margin = frame.margin; let frame_margin = frame.margin;
frame frame