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/animation/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/animation') 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 { -- cgit