From 1c02552e921c7f902e7ef805ecf89301c90f4ad9 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Fri, 23 Aug 2024 15:39:45 +0300 Subject: animation: Make restarted() take by-ref --- src/animation/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') 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. -- cgit