From 8bebd54c6d63e3e500399f9737a0906de30dfbbe Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Tue, 5 Mar 2024 10:33:25 +0400 Subject: tile: Prepare for oscillating animations --- src/layout/tile.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/layout') diff --git a/src/layout/tile.rs b/src/layout/tile.rs index ca2779fe..816c92e1 100644 --- a/src/layout/tile.rs +++ b/src/layout/tile.rs @@ -198,7 +198,8 @@ impl Tile { .open_animation .as_ref() .map(|anim| anim.value()) - .unwrap_or(1.); + .unwrap_or(1.) + .max(0.); Size::from(((f64::from(size.w) * v).round() as i32, size.h)) } @@ -356,7 +357,7 @@ impl Tile { renderer, scale.x as i32, &elements, - anim.value() as f32, + anim.value().clamp(0., 1.) as f32, ); self.window() .set_offscreen_element_id(Some(elem.id().clone())); @@ -369,7 +370,7 @@ impl Tile { RescaleRenderElement::from_element( elem, center.to_physical_precise_round(scale), - (anim.value() / 2. + 0.5).min(1.), + (anim.value() / 2. + 0.5).max(0.), ), )) .into_iter() -- cgit