Fix debug-assert hit in panel sizing code
This commit is contained in:
parent
dce5696b67
commit
155e138998
|
|
@ -262,9 +262,7 @@ impl SidePanel {
|
|||
let frame = frame.unwrap_or_else(|| Frame::side_top_panel(ui.style()));
|
||||
let inner_response = frame.show(&mut panel_ui, |ui| {
|
||||
ui.set_min_height(ui.max_rect().height()); // Make sure the frame fills the full height
|
||||
ui.set_min_width(
|
||||
width_range.min - (frame.inner_margin.left + frame.inner_margin.right),
|
||||
);
|
||||
ui.set_min_width((width_range.min - frame.inner_margin.sum().x).at_least(0.0));
|
||||
add_contents(ui)
|
||||
});
|
||||
|
||||
|
|
@ -730,9 +728,7 @@ impl TopBottomPanel {
|
|||
let frame = frame.unwrap_or_else(|| Frame::side_top_panel(ui.style()));
|
||||
let inner_response = frame.show(&mut panel_ui, |ui| {
|
||||
ui.set_min_width(ui.max_rect().width()); // Make the frame fill full width
|
||||
ui.set_min_height(
|
||||
height_range.min - (frame.inner_margin.top + frame.inner_margin.bottom),
|
||||
);
|
||||
ui.set_min_height((height_range.min - frame.inner_margin.sum().y).at_least(0.0));
|
||||
add_contents(ui)
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -248,6 +248,9 @@ impl Placer {
|
|||
/// Set the minimum width of the ui.
|
||||
/// This can't shrink the ui, only make it larger.
|
||||
pub(crate) fn set_min_width(&mut self, width: f32) {
|
||||
if width <= 0.0 {
|
||||
return;
|
||||
}
|
||||
let rect = self.next_widget_space_ignore_wrap_justify(vec2(width, 0.0));
|
||||
self.region.expand_to_include_x(rect.min.x);
|
||||
self.region.expand_to_include_x(rect.max.x);
|
||||
|
|
@ -256,6 +259,9 @@ impl Placer {
|
|||
/// Set the minimum height of the ui.
|
||||
/// This can't shrink the ui, only make it larger.
|
||||
pub(crate) fn set_min_height(&mut self, height: f32) {
|
||||
if height <= 0.0 {
|
||||
return;
|
||||
}
|
||||
let rect = self.next_widget_space_ignore_wrap_justify(vec2(0.0, height));
|
||||
self.region.expand_to_include_y(rect.min.y);
|
||||
self.region.expand_to_include_y(rect.max.y);
|
||||
|
|
|
|||
|
|
@ -530,12 +530,14 @@ impl Ui {
|
|||
/// Set the minimum width of the ui.
|
||||
/// This can't shrink the ui, only make it larger.
|
||||
pub fn set_min_width(&mut self, width: f32) {
|
||||
egui_assert!(0.0 <= width);
|
||||
self.placer.set_min_width(width);
|
||||
}
|
||||
|
||||
/// Set the minimum height of the ui.
|
||||
/// This can't shrink the ui, only make it larger.
|
||||
pub fn set_min_height(&mut self, height: f32) {
|
||||
egui_assert!(0.0 <= height);
|
||||
self.placer.set_min_height(height);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue