aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-02-28 17:23:03 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-02-28 17:23:03 +0400
commit8018839f5d970b0960936a4d7d984a8599785988 (patch)
tree0830ffa82c6c80f75ea6f64737ebdca17418bda9 /src
parent077f22edd6e562e2cfed626afaedd095997eb013 (diff)
downloadniri-8018839f5d970b0960936a4d7d984a8599785988.tar.gz
niri-8018839f5d970b0960936a4d7d984a8599785988.tar.bz2
niri-8018839f5d970b0960936a4d7d984a8599785988.zip
Extract animate_view_offset_to_column()
Diffstat (limited to 'src')
-rw-r--r--src/layout/workspace.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs
index 8558dd89..fce5719d 100644
--- a/src/layout/workspace.rs
+++ b/src/layout/workspace.rs
@@ -459,12 +459,7 @@ impl<W: LayoutElement> Workspace<W> {
self.animate_view_offset(current_x, idx, new_view_offset);
}
- fn activate_column(&mut self, idx: usize) {
- if self.active_column_idx == idx {
- return;
- }
-
- let current_x = self.view_pos();
+ fn animate_view_offset_to_column(&mut self, current_x: i32, idx: usize) {
match self.options.center_focused_column {
CenterFocusedColumn::Always => {
self.animate_view_offset_to_column_centered(current_x, idx)
@@ -500,6 +495,15 @@ impl<W: LayoutElement> Workspace<W> {
}
CenterFocusedColumn::Never => self.animate_view_offset_to_column_fit(current_x, idx),
};
+ }
+
+ fn activate_column(&mut self, idx: usize) {
+ if self.active_column_idx == idx {
+ return;
+ }
+
+ let current_x = self.view_pos();
+ self.animate_view_offset_to_column(current_x, idx);
self.active_column_idx = idx;