forge
Explore
Log in

Don't you dare go Hollow

layout: Extract max_tile_height

Browse files at this commit

32ad545f842f4c176548e30d183d10e0a2bab752Ivan MolodetskikhParent: 4eddcef
src/layout/scrolling.rsmodified+3 -6
@@ -3405,6 +3405,7 @@ impl<W: LayoutElement> Column<W> {
3405 3405
3406 let width = width.resolve(&self.options, self.working_area.size.w);3406 let width = width.resolve(&self.options, self.working_area.size.w);
3407 let width = f64::max(f64::min(width, max_width), min_width);3407 let width = f64::max(f64::min(width, max_width), min_width);
3408+ let max_tile_height = self.working_area.size.h - self.options.gaps * 2.;
3408 3409
3409 // If there are multiple windows in a column, clamp the non-auto window's height according3410 // If there are multiple windows in a column, clamp the non-auto window's height according
3410 // to other windows' min sizes.3411 // to other windows' min sizes.
@@ -3423,10 +3424,7 @@ impl<W: LayoutElement> Column<W> {
3423 .sum::<f64>();3424 .sum::<f64>();
3424 3425
3425 let tile = &self.tiles[non_auto_idx];3426 let tile = &self.tiles[non_auto_idx];
3426- let height_left = self.working_area.size.h3427+ let height_left = max_tile_height - min_height_taken;
3427- - self.options.gaps
3428- - min_height_taken
3429- - self.options.gaps;
3430 max_non_auto_window_height = Some(f64::max(3428 max_non_auto_window_height = Some(f64::max(
3431 1.,3429 1.,
3432 tile.window_height_for_tile_height(height_left).round(),3430 tile.window_height_for_tile_height(height_left).round(),
@@ -3444,8 +3442,7 @@ impl<W: LayoutElement> Column<W> {
3444 window_height = f64::min(window_height, max);3442 window_height = f64::min(window_height, max);
3445 } else {3443 } else {
3446 // In any case, clamp to the working area height.3444 // In any case, clamp to the working area height.
3447- let height_left = self.working_area.size.h - self.options.gaps * 2.;3445+ let max = tile.window_height_for_tile_height(max_tile_height).round();
3448- let max = tile.window_height_for_tile_height(height_left).round();
3449 window_height = f64::min(window_height, max);3446 window_height = f64::min(window_height, max);
3450 }3447 }
3451 3448