Fix: The background of CentralPanel will now cover unused space too

This commit is contained in:
Emil Ernerfeldt 2020-12-19 11:17:21 +01:00
parent ea10add1cb
commit ce0ea74c9f
2 changed files with 9 additions and 1 deletions

View file

@ -29,6 +29,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* `Slider` and `DragValue` uses fewer decimals by default. See the full precision by hovering over the value. * `Slider` and `DragValue` uses fewer decimals by default. See the full precision by hovering over the value.
* `egui::App`: added `fn name(&self)` and `fn clear_color(&self)`. * `egui::App`: added `fn name(&self)` and `fn clear_color(&self)`.
### Fixed 🐛
* The background for `CentralPanel` will now cover unused space too.
### Deprecated ### Deprecated
* `RawInput::screen_size` - use `RawInput::screen_rect` instead. * `RawInput::screen_size` - use `RawInput::screen_rect` instead.
* left/centered/right column functions on `Ui`. * left/centered/right column functions on `Ui`.

View file

@ -138,7 +138,11 @@ impl CentralPanel {
let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect); let mut panel_ui = Ui::new(ctx.clone(), layer_id, id, panel_rect, clip_rect);
let frame = Frame::background(&ctx.style()); let frame = Frame::background(&ctx.style());
let r = frame.show(&mut panel_ui, |ui| add_contents(ui)); let r = frame.show(&mut panel_ui, |ui| {
let r = add_contents(ui);
ui.expand_to_include_rect(ui.max_rect()); // Use it all
r
});
let panel_rect = panel_ui.min_rect(); let panel_rect = panel_ui.min_rect();
let response = panel_ui.interact_hover(panel_rect); let response = panel_ui.interact_hover(panel_rect);