From e448cfb0efee0efbfc769662ee77ad22a347dc02 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Mon, 8 Apr 2024 22:16:11 +0400 Subject: Adjust view offset anim together with offset Not doing this caused quickly moving a column right and left to base the final view position on an incorrect view offset. --- src/layout/workspace.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/layout/workspace.rs') diff --git a/src/layout/workspace.rs b/src/layout/workspace.rs index f5b425bd..f337a74a 100644 --- a/src/layout/workspace.rs +++ b/src/layout/workspace.rs @@ -963,13 +963,15 @@ impl Workspace { let current_col_x = self.column_x(self.active_column_idx); let next_col_x = self.column_x(self.active_column_idx + 1); - let current_x = current_col_x + self.view_offset; - let column = self.columns.remove(self.active_column_idx); self.columns.insert(new_idx, column); // Preserve the camera position when moving to the left. - self.view_offset = current_x - self.column_x(self.active_column_idx); + let view_offset_delta = -self.column_x(self.active_column_idx) + current_col_x; + self.view_offset += view_offset_delta; + if let Some(ViewOffsetAdjustment::Animation(anim)) = &mut self.view_offset_adj { + anim.offset(view_offset_delta as f64); + } // The column we just moved is offset by the difference between its new and old position. let new_col_x = self.column_x(new_idx); -- cgit