aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/animation/mod.rs10
-rw-r--r--src/layout/workspace.rs8
2 files changed, 15 insertions, 3 deletions
diff --git a/src/animation/mod.rs b/src/animation/mod.rs
index 7984b0d9..d8e8cbd5 100644
--- a/src/animation/mod.rs
+++ b/src/animation/mod.rs
@@ -261,6 +261,16 @@ impl Animation {
pub fn from(&self) -> f64 {
self.from
}
+
+ pub fn offset(&mut self, offset: f64) {
+ self.from += offset;
+ self.to += offset;
+
+ if let Kind::Spring(spring) = &mut self.kind {
+ spring.from += offset;
+ spring.to += offset;
+ }
+ }
}
impl Curve {
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<W: LayoutElement> Workspace<W> {
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);