layout/scrolling: Extract two variables
Browse files at this commit1d87da00b78972cae50f9c1f9c8e8d6e9aff82bcParent: 91515ac1 changed file +13 -10
- src/layout/scrolling.rs +13 -10
src/layout/scrolling.rsmodified+13 -10
| @@ -4100,6 +4100,9 @@ impl<W: LayoutElement> Column<W> { | |||
| 4100 | } | 4100 | } |
| 4101 | } | 4101 | } |
| 4102 | 4102 | ||
| 4103 | + let working_size = self.working_area.size; | ||
| 4104 | + let gaps = self.options.gaps; | ||
| 4105 | + | ||
| 4103 | let mut found_fixed = false; | 4106 | let mut found_fixed = false; |
| 4104 | let mut total_height = 0.; | 4107 | let mut total_height = 0.; |
| 4105 | let mut total_min_height = 0.; | 4108 | let mut total_min_height = 0.; |
| @@ -4134,12 +4137,12 @@ impl<W: LayoutElement> Column<W> { | |||
| 4134 | 4137 | ||
| 4135 | if !self.is_fullscreen | 4138 | if !self.is_fullscreen |
| 4136 | && self.scale.round() == self.scale | 4139 | && self.scale.round() == self.scale |
| 4137 | - && self.working_area.size.h.round() == self.working_area.size.h | 4140 | + && working_size.h.round() == working_size.h |
| 4138 | - && self.options.gaps.round() == self.options.gaps | 4141 | + && gaps.round() == gaps |
| 4139 | { | 4142 | { |
| 4140 | - let total_height = requested_tile_height + self.options.gaps * 2.; | 4143 | + let total_height = requested_tile_height + gaps * 2.; |
| 4141 | - let total_min_height = min_tile_height + self.options.gaps * 2.; | 4144 | + let total_min_height = min_tile_height + gaps * 2.; |
| 4142 | - let max_height = f64::max(total_min_height, self.working_area.size.h); | 4145 | + let max_height = f64::max(total_min_height, working_size.h); |
| 4143 | assert!( | 4146 | assert!( |
| 4144 | total_height <= max_height, | 4147 | total_height <= max_height, |
| 4145 | "each tile in a column mustn't go beyond working area height \ | 4148 | "each tile in a column mustn't go beyond working area height \ |
| @@ -4153,12 +4156,12 @@ impl<W: LayoutElement> Column<W> { | |||
| 4153 | 4156 | ||
| 4154 | if tile_count > 1 | 4157 | if tile_count > 1 |
| 4155 | && self.scale.round() == self.scale | 4158 | && self.scale.round() == self.scale |
| 4156 | - && self.working_area.size.h.round() == self.working_area.size.h | 4159 | + && working_size.h.round() == working_size.h |
| 4157 | - && self.options.gaps.round() == self.options.gaps | 4160 | + && gaps.round() == gaps |
| 4158 | { | 4161 | { |
| 4159 | - total_height += self.options.gaps * (tile_count + 1) as f64; | 4162 | + total_height += gaps * (tile_count + 1) as f64; |
| 4160 | - total_min_height += self.options.gaps * (tile_count + 1) as f64; | 4163 | + total_min_height += gaps * (tile_count + 1) as f64; |
| 4161 | - let max_height = f64::max(total_min_height, self.working_area.size.h); | 4164 | + let max_height = f64::max(total_min_height, working_size.h); |
| 4162 | assert!( | 4165 | assert!( |
| 4163 | total_height <= max_height, | 4166 | total_height <= max_height, |
| 4164 | "multiple tiles in a column mustn't go beyond working area height \ | 4167 | "multiple tiles in a column mustn't go beyond working area height \ |