layout: Extract col variable
Browse files at this commitb31c0359ebce114ae2f9b4e5df3dc37a93f5115eParent: 934e5a61 changed file +7 -9
- src/layout/scrolling.rs +7 -9
src/layout/scrolling.rsmodified+7 -9
| @@ -2116,26 +2116,24 @@ impl<W: LayoutElement> ScrollingSpace<W> { | |||
| 2116 | error!("insert hint column index is out of range"); | 2116 | error!("insert hint column index is out of range"); |
| 2117 | return None; | 2117 | return None; |
| 2118 | } | 2118 | } |
| 2119 | - if tile_index > self.columns[column_index].tiles.len() { | 2119 | + |
| 2120 | + let col = &self.columns[column_index]; | ||
| 2121 | + if tile_index > col.tiles.len() { | ||
| 2120 | error!("insert hint tile index is out of range"); | 2122 | error!("insert hint tile index is out of range"); |
| 2121 | return None; | 2123 | return None; |
| 2122 | } | 2124 | } |
| 2123 | 2125 | ||
| 2124 | let (height, y) = if tile_index == 0 { | 2126 | let (height, y) = if tile_index == 0 { |
| 2125 | - (150., self.columns[column_index].tile_offset(tile_index).y) | 2127 | + (150., col.tile_offset(tile_index).y) |
| 2126 | - } else if tile_index == self.columns[column_index].tiles.len() { | 2128 | + } else if tile_index == col.tiles.len() { |
| 2127 | ( | 2129 | ( |
| 2128 | 150., | 2130 | 150., |
| 2129 | - self.columns[column_index].tile_offset(tile_index).y | 2131 | + col.tile_offset(tile_index).y - self.options.gaps - 150., |
| 2130 | - - self.options.gaps | ||
| 2131 | - - 150., | ||
| 2132 | ) | 2132 | ) |
| 2133 | } else { | 2133 | } else { |
| 2134 | ( | 2134 | ( |
| 2135 | 300., | 2135 | 300., |
| 2136 | - self.columns[column_index].tile_offset(tile_index).y | 2136 | + col.tile_offset(tile_index).y - self.options.gaps / 2. - 150., |
| 2137 | - - self.options.gaps / 2. | ||
| 2138 | - - 150., | ||
| 2139 | ) | 2137 | ) |
| 2140 | }; | 2138 | }; |
| 2141 | 2139 | ||