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> {
34053405
34063406 let width = width.resolve(&self.options, self.working_area.size.w);
34073407 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.;
34083409
34093410 // If there are multiple windows in a column, clamp the non-auto window's height according
34103411 // to other windows' min sizes.
@@ -3423,10 +3424,7 @@ impl<W: LayoutElement> Column<W> {
34233424 .sum::<f64>();
34243425
34253426 let tile = &self.tiles[non_auto_idx];
3426- let height_left = self.working_area.size.h
3427- - self.options.gaps
3428- - min_height_taken
3429- - self.options.gaps;
3427+ let height_left = max_tile_height - min_height_taken;
34303428 max_non_auto_window_height = Some(f64::max(
34313429 1.,
34323430 tile.window_height_for_tile_height(height_left).round(),
@@ -3444,8 +3442,7 @@ impl<W: LayoutElement> Column<W> {
34443442 window_height = f64::min(window_height, max);
34453443 } else {
34463444 // In any case, clamp to the working area height.
3447- let height_left = self.working_area.size.h - self.options.gaps * 2.;
3448- let max = tile.window_height_for_tile_height(height_left).round();
3445+ let max = tile.window_height_for_tile_height(max_tile_height).round();
34493446 window_height = f64::min(window_height, max);
34503447 }
34513448