aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIvan Molodetskikh <yalterz@gmail.com>2024-08-23 15:39:45 +0300
committerIvan Molodetskikh <yalterz@gmail.com>2024-08-23 15:39:45 +0300
commit1c02552e921c7f902e7ef805ecf89301c90f4ad9 (patch)
tree5190ecd2145efd7aba2a4fff37d176222841b22c /src
parentff7cbb97dfc1bc584b4363f60858ef132bb0bda4 (diff)
downloadniri-1c02552e921c7f902e7ef805ecf89301c90f4ad9.tar.gz
niri-1c02552e921c7f902e7ef805ecf89301c90f4ad9.tar.bz2
niri-1c02552e921c7f902e7ef805ecf89301c90f4ad9.zip
animation: Make restarted() take by-ref
Diffstat (limited to 'src')
-rw-r--r--src/animation/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/animation/mod.rs b/src/animation/mod.rs
index 0d8b061e..ecd8d960 100644
--- a/src/animation/mod.rs
+++ b/src/animation/mod.rs
@@ -11,7 +11,7 @@ pub use spring::{Spring, SpringParams};
pub static ANIMATION_SLOWDOWN: AtomicF64 = AtomicF64::new(1.);
-#[derive(Debug)]
+#[derive(Debug, Clone)]
pub struct Animation {
from: f64,
to: f64,
@@ -101,9 +101,9 @@ impl Animation {
}
/// Restarts the animation using the previous config.
- pub fn restarted(self, from: f64, to: f64, initial_velocity: f64) -> Self {
+ pub fn restarted(&self, from: f64, to: f64, initial_velocity: f64) -> Self {
if self.is_off {
- return self;
+ return self.clone();
}
// Scale the velocity by slowdown to keep the touchpad gestures feeling right.