aboutsummaryrefslogtreecommitdiff
path: root/src/animation/mod.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-04-08 22:16:11 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2024-04-08 22:16:35 +0400
commite448cfb0efee0efbfc769662ee77ad22a347dc02 (patch)
treec3087f46de5419e14b6c96e66d31ab2bed060d3a /src/animation/mod.rs
parent6aceb3a798f0abde0ec2309b599687c05b792a68 (diff)
downloadniri-e448cfb0efee0efbfc769662ee77ad22a347dc02.tar.gz
niri-e448cfb0efee0efbfc769662ee77ad22a347dc02.tar.bz2
niri-e448cfb0efee0efbfc769662ee77ad22a347dc02.zip
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.
Diffstat (limited to 'src/animation/mod.rs')
-rw-r--r--src/animation/mod.rs10
1 files changed, 10 insertions, 0 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 {