diff --git a/crates/egui/src/containers/area.rs b/crates/egui/src/containers/area.rs index 07f9b3a06ab..1bb15483541 100644 --- a/crates/egui/src/containers/area.rs +++ b/crates/egui/src/containers/area.rs @@ -108,7 +108,7 @@ impl Area { sense: None, movable: true, interactable: true, - constrain: false, + constrain: true, constrain_rect: None, enabled: true, order: Order::Middle, @@ -229,6 +229,8 @@ impl Area { } /// Constrains this area to [`Context::screen_rect`]? + /// + /// Default: `true`. #[inline] pub fn constrain(mut self, constrain: bool) -> Self { self.constrain = constrain; diff --git a/crates/egui/src/containers/popup.rs b/crates/egui/src/containers/popup.rs index ed2a15989ac..58c834aebd1 100644 --- a/crates/egui/src/containers/popup.rs +++ b/crates/egui/src/containers/popup.rs @@ -128,7 +128,6 @@ fn show_tooltip_at_avoid_dyn<'c, R>( .pivot(pivot) .fixed_pos(anchor) .default_width(ctx.style().spacing.tooltip_width) - .constrain_to(screen_rect) .interactable(false) .show(ctx, |ui| { Frame::popup(&ctx.style()).show_dyn(ui, add_contents).inner @@ -288,7 +287,6 @@ pub fn popup_above_or_below_widget( let inner = Area::new(popup_id) .order(Order::Foreground) - .constrain(true) .fixed_pos(pos) .default_width(inner_width) .pivot(pivot) diff --git a/crates/egui/src/containers/window.rs b/crates/egui/src/containers/window.rs index 2a9b676638b..4cf2c174ed8 100644 --- a/crates/egui/src/containers/window.rs +++ b/crates/egui/src/containers/window.rs @@ -49,7 +49,7 @@ impl<'open> Window<'open> { /// If you need a changing title, you must call `window.id(…)` with a fixed id. pub fn new(title: impl Into) -> Self { let title = title.into().fallback_text_style(TextStyle::Heading); - let area = Area::new(Id::new(title.text())).constrain(true); + let area = Area::new(Id::new(title.text())); Self { title, open: None, diff --git a/crates/egui/src/menu.rs b/crates/egui/src/menu.rs index 7d76763f53a..81f14c5d3ec 100644 --- a/crates/egui/src/menu.rs +++ b/crates/egui/src/menu.rs @@ -148,7 +148,6 @@ fn menu_popup<'c, R>( let area = Area::new(menu_id.with("__menu")) .order(Order::Foreground) .fixed_pos(pos) - .constrain_to(ctx.screen_rect()) .interactable(true) .default_width(ctx.style().spacing.menu_width) .sense(Sense::hover()); diff --git a/crates/egui/src/widgets/color_picker.rs b/crates/egui/src/widgets/color_picker.rs index 6935de4536d..f7efa0bd9da 100644 --- a/crates/egui/src/widgets/color_picker.rs +++ b/crates/egui/src/widgets/color_picker.rs @@ -491,7 +491,6 @@ pub fn color_edit_button_hsva(ui: &mut Ui, hsva: &mut Hsva, alpha: Alpha) -> Res let area_response = Area::new(popup_id) .order(Order::Foreground) .fixed_pos(button_response.rect.max) - .constrain(true) .show(ui.ctx(), |ui| { ui.spacing_mut().slider_width = COLOR_SLIDER_WIDTH; Frame::popup(ui.style()).show(ui, |ui| { diff --git a/crates/egui_extras/src/datepicker/button.rs b/crates/egui_extras/src/datepicker/button.rs index 839adebfc47..1a4dea82eb6 100644 --- a/crates/egui_extras/src/datepicker/button.rs +++ b/crates/egui_extras/src/datepicker/button.rs @@ -142,7 +142,6 @@ impl<'a> Widget for DatePickerButton<'a> { } = Area::new(ui.make_persistent_id(self.id_source)) .order(Order::Foreground) .fixed_pos(pos) - .constrain_to(ui.ctx().screen_rect()) .show(ui.ctx(), |ui| { let frame = Frame::popup(ui.style()); frame