From 82add180a7a72e4c832bb907215f473163255789 Mon Sep 17 00:00:00 2001 From: Luke Chu <37006668+lukechu10@users.noreply.github.com> Date: Sun, 24 Oct 2021 22:01:00 -0700 Subject: [PATCH] Fix `Lerp` implementation for integers (#289) --- packages/sycamore/src/motion.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/sycamore/src/motion.rs b/packages/sycamore/src/motion.rs index 055d14129..d159d4daa 100644 --- a/packages/sycamore/src/motion.rs +++ b/packages/sycamore/src/motion.rs @@ -33,7 +33,7 @@ macro_rules! impl_lerp_for_int { ($i: path) => { impl Lerp for $i { fn lerp(&self, other: &Self, scalar: f32) -> Self { - ((self + (other - self)) as f32 * scalar).round() as $i + (*self as f32 + (other - self) as f32 * scalar).round() as $i } } }; @@ -44,12 +44,14 @@ impl_lerp_for_int!(i16); impl_lerp_for_int!(i32); impl_lerp_for_int!(i64); impl_lerp_for_int!(i128); +impl_lerp_for_int!(isize); impl_lerp_for_int!(u8); impl_lerp_for_int!(u16); impl_lerp_for_int!(u32); impl_lerp_for_int!(u64); impl_lerp_for_int!(u128); +impl_lerp_for_int!(usize); impl Lerp for [T; N] { fn lerp(&self, other: &Self, scalar: f32) -> Self {