Extract animate_view_offset_to_column()
Browse files at this commit8018839f5d970b0960936a4d7d984a8599785988Parent: 077f22e1 changed file +10 -6
- src/layout/workspace.rs +10 -6
src/layout/workspace.rsmodified+10 -6
| @@ -459,12 +459,7 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 459 | self.animate_view_offset(current_x, idx, new_view_offset); | 459 | self.animate_view_offset(current_x, idx, new_view_offset); |
| 460 | } | 460 | } |
| 461 | 461 | ||
| 462 | - fn activate_column(&mut self, idx: usize) { | 462 | + fn animate_view_offset_to_column(&mut self, current_x: i32, idx: usize) { |
| 463 | - if self.active_column_idx == idx { | ||
| 464 | - return; | ||
| 465 | - } | ||
| 466 | - | ||
| 467 | - let current_x = self.view_pos(); | ||
| 468 | match self.options.center_focused_column { | 463 | match self.options.center_focused_column { |
| 469 | CenterFocusedColumn::Always => { | 464 | CenterFocusedColumn::Always => { |
| 470 | self.animate_view_offset_to_column_centered(current_x, idx) | 465 | self.animate_view_offset_to_column_centered(current_x, idx) |
| @@ -500,6 +495,15 @@ impl<W: LayoutElement> Workspace<W> { | |||
| 500 | } | 495 | } |
| 501 | CenterFocusedColumn::Never => self.animate_view_offset_to_column_fit(current_x, idx), | 496 | CenterFocusedColumn::Never => self.animate_view_offset_to_column_fit(current_x, idx), |
| 502 | }; | 497 | }; |
| 498 | + } | ||
| 499 | + | ||
| 500 | + fn activate_column(&mut self, idx: usize) { | ||
| 501 | + if self.active_column_idx == idx { | ||
| 502 | + return; | ||
| 503 | + } | ||
| 504 | + | ||
| 505 | + let current_x = self.view_pos(); | ||
| 506 | + self.animate_view_offset_to_column(current_x, idx); | ||
| 503 | 507 | ||
| 504 | self.active_column_idx = idx; | 508 | self.active_column_idx = idx; |
| 505 | 509 | ||