aboutsummaryrefslogtreecommitdiff
path: root/src/animation.rs
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2023-09-13 16:57:12 +0400
committerIvan Molodetskikh <yalterz@gmail.com>2023-09-13 16:57:12 +0400
commit219ca08836adcd91f42ca24ec20f643af17dd270 (patch)
tree3395f5dda3bcd3a2be755bdbc401a43a8a45d2b9 /src/animation.rs
parentc8b85b83c7d1db9ae4834fa95223cfb8b13e276a (diff)
downloadniri-219ca08836adcd91f42ca24ec20f643af17dd270.tar.gz
niri-219ca08836adcd91f42ca24ec20f643af17dd270.tar.bz2
niri-219ca08836adcd91f42ca24ec20f643af17dd270.zip
Implement minimizing view movement on changes
Before this commit, windows were always left-aligned. Now, when changing focus, if the window is fully visible, the view doesn't move. If the window is not fully visible, the view is moved the minimum amount.
Diffstat (limited to 'src/animation.rs')
-rw-r--r--src/animation.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/animation.rs b/src/animation.rs
index 430e3516..e2b9dc39 100644
--- a/src/animation.rs
+++ b/src/animation.rs
@@ -46,4 +46,8 @@ impl Animation {
let x = (passed / total).clamp(0., 1.);
EaseOutCubic.y(x) * (self.to - self.from) + self.from
}
+
+ pub fn to(&self) -> f64 {
+ self.to
+ }
}