File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -262,9 +262,7 @@ impl SidePanel {
262
262
let frame = frame. unwrap_or_else ( || Frame :: side_top_panel ( ui. style ( ) ) ) ;
263
263
let inner_response = frame. show ( & mut panel_ui, |ui| {
264
264
ui. set_min_height ( ui. max_rect ( ) . height ( ) ) ; // Make sure the frame fills the full height
265
- ui. set_min_width (
266
- width_range. min - ( frame. inner_margin . left + frame. inner_margin . right ) ,
267
- ) ;
265
+ ui. set_min_width ( ( width_range. min - frame. inner_margin . sum ( ) . x ) . at_least ( 0.0 ) ) ;
268
266
add_contents ( ui)
269
267
} ) ;
270
268
@@ -730,9 +728,7 @@ impl TopBottomPanel {
730
728
let frame = frame. unwrap_or_else ( || Frame :: side_top_panel ( ui. style ( ) ) ) ;
731
729
let inner_response = frame. show ( & mut panel_ui, |ui| {
732
730
ui. set_min_width ( ui. max_rect ( ) . width ( ) ) ; // Make the frame fill full width
733
- ui. set_min_height (
734
- height_range. min - ( frame. inner_margin . top + frame. inner_margin . bottom ) ,
735
- ) ;
731
+ ui. set_min_height ( ( height_range. min - frame. inner_margin . sum ( ) . y ) . at_least ( 0.0 ) ) ;
736
732
add_contents ( ui)
737
733
} ) ;
738
734
Original file line number Diff line number Diff line change @@ -248,6 +248,9 @@ impl Placer {
248
248
/// Set the minimum width of the ui.
249
249
/// This can't shrink the ui, only make it larger.
250
250
pub ( crate ) fn set_min_width ( & mut self , width : f32 ) {
251
+ if width <= 0.0 {
252
+ return ;
253
+ }
251
254
let rect = self . next_widget_space_ignore_wrap_justify ( vec2 ( width, 0.0 ) ) ;
252
255
self . region . expand_to_include_x ( rect. min . x ) ;
253
256
self . region . expand_to_include_x ( rect. max . x ) ;
@@ -256,6 +259,9 @@ impl Placer {
256
259
/// Set the minimum height of the ui.
257
260
/// This can't shrink the ui, only make it larger.
258
261
pub ( crate ) fn set_min_height ( & mut self , height : f32 ) {
262
+ if height <= 0.0 {
263
+ return ;
264
+ }
259
265
let rect = self . next_widget_space_ignore_wrap_justify ( vec2 ( 0.0 , height) ) ;
260
266
self . region . expand_to_include_y ( rect. min . y ) ;
261
267
self . region . expand_to_include_y ( rect. max . y ) ;
Original file line number Diff line number Diff line change @@ -530,12 +530,14 @@ impl Ui {
530
530
/// Set the minimum width of the ui.
531
531
/// This can't shrink the ui, only make it larger.
532
532
pub fn set_min_width ( & mut self , width : f32 ) {
533
+ egui_assert ! ( 0.0 <= width) ;
533
534
self . placer . set_min_width ( width) ;
534
535
}
535
536
536
537
/// Set the minimum height of the ui.
537
538
/// This can't shrink the ui, only make it larger.
538
539
pub fn set_min_height ( & mut self , height : f32 ) {
540
+ egui_assert ! ( 0.0 <= height) ;
539
541
self . placer . set_min_height ( height) ;
540
542
}
541
543
You can’t perform that action at this time.
0 commit comments