diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-23 15:39:45 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-08-23 15:39:45 +0300 |
| commit | 1c02552e921c7f902e7ef805ecf89301c90f4ad9 (patch) | |
| tree | 5190ecd2145efd7aba2a4fff37d176222841b22c | |
| parent | ff7cbb97dfc1bc584b4363f60858ef132bb0bda4 (diff) | |
| download | niri-1c02552e921c7f902e7ef805ecf89301c90f4ad9.tar.gz niri-1c02552e921c7f902e7ef805ecf89301c90f4ad9.tar.bz2 niri-1c02552e921c7f902e7ef805ecf89301c90f4ad9.zip | |
animation: Make restarted() take by-ref
| -rw-r--r-- | src/animation/mod.rs | 6 |
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. |
