layout: Fix expel animation of the smaller window in column
Browse files at this commit33b39913c7121a6c7b112beb0e329c3e64e4f57aParent: d5cbc351 changed file +9 -7
- src/layout/workspace.rs +9 -7
src/layout/workspace.rsmodified+9 -7
| @@ -2033,29 +2033,29 @@ impl<W: LayoutElement> Workspace<W> { | ||
| 2033 | 2033 | return; |
| 2034 | 2034 | } |
| 2035 | 2035 | |
| 2036 | - let offset = | |
| 2037 | - self.column_x(self.active_column_idx) - self.column_x(self.active_column_idx + 1); | |
| 2038 | - let mut offset = Point::from((offset, 0.)); | |
| 2036 | + let source_col_idx = self.active_column_idx; | |
| 2037 | + let target_col_idx = self.active_column_idx + 1; | |
| 2038 | + let cur_x = self.column_x(source_col_idx); | |
| 2039 | 2039 | |
| 2040 | 2040 | let source_column = &self.columns[self.active_column_idx]; |
| 2041 | 2041 | if source_column.tiles.len() == 1 { |
| 2042 | 2042 | return; |
| 2043 | 2043 | } |
| 2044 | 2044 | |
| 2045 | - offset.x += source_column.render_offset().x; | |
| 2045 | + let mut offset = Point::from((source_column.render_offset().x, 0.)); | |
| 2046 | 2046 | let prev_off = source_column.tile_offset(source_column.active_tile_idx); |
| 2047 | 2047 | |
| 2048 | 2048 | let width = source_column.width; |
| 2049 | 2049 | let is_full_width = source_column.is_full_width; |
| 2050 | 2050 | let tile = self.remove_tile_by_idx( |
| 2051 | - self.active_column_idx, | |
| 2051 | + source_col_idx, | |
| 2052 | 2052 | source_column.active_tile_idx, |
| 2053 | 2053 | Transaction::new(), |
| 2054 | 2054 | None, |
| 2055 | 2055 | ); |
| 2056 | 2056 | |
| 2057 | 2057 | self.add_tile( |
| 2058 | - Some(self.active_column_idx + 1), | |
| 2058 | + Some(target_col_idx), | |
| 2059 | 2059 | tile, |
| 2060 | 2060 | true, |
| 2061 | 2061 | width, |
| @@ -2063,7 +2063,9 @@ impl<W: LayoutElement> Workspace<W> { | ||
| 2063 | 2063 | Some(self.options.animations.window_movement.0), |
| 2064 | 2064 | ); |
| 2065 | 2065 | |
| 2066 | - let new_col = &mut self.columns[self.active_column_idx]; | |
| 2066 | + offset.x += cur_x - self.column_x(target_col_idx); | |
| 2067 | + | |
| 2068 | + let new_col = &mut self.columns[target_col_idx]; | |
| 2067 | 2069 | offset += prev_off - new_col.tile_offset(0); |
| 2068 | 2070 | new_col.tiles[0].animate_move_from(offset); |
| 2069 | 2071 | } |