Use movement anim for view anim during movement

This commit is contained in:
Ivan Molodetskikh
2024-04-17 14:29:22 +04:00
parent 7ca39baf9e
commit dfe49aa705
+14 -2
View File
@@ -651,12 +651,24 @@ impl<W: LayoutElement> Workspace<W> {
} }
fn activate_column(&mut self, idx: usize) { fn activate_column(&mut self, idx: usize) {
self.activate_column_with_anim_config(
idx,
self.options.animations.horizontal_view_movement.0,
);
}
fn activate_column_with_anim_config(&mut self, idx: usize, config: niri_config::Animation) {
if self.active_column_idx == idx { if self.active_column_idx == idx {
return; return;
} }
let current_x = self.view_pos(); let current_x = self.view_pos();
self.animate_view_offset_to_column(current_x, idx, Some(self.active_column_idx)); self.animate_view_offset_to_column_with_config(
current_x,
idx,
Some(self.active_column_idx),
config,
);
self.active_column_idx = idx; self.active_column_idx = idx;
@@ -1315,7 +1327,7 @@ impl<W: LayoutElement> Workspace<W> {
} }
} }
self.activate_column(new_idx); self.activate_column_with_anim_config(new_idx, self.options.animations.window_movement.0);
} }
pub fn move_left(&mut self) { pub fn move_left(&mut self) {