diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-05 10:33:25 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-03-05 10:33:25 +0400 |
| commit | 8bebd54c6d63e3e500399f9737a0906de30dfbbe (patch) | |
| tree | f9de3238b6194c3fb610f8f8a3552c2a695e0529 /src/layout | |
| parent | 1978e5b0b89b5c8db5316c8a0684728f23b94fc9 (diff) | |
| download | niri-8bebd54c6d63e3e500399f9737a0906de30dfbbe.tar.gz niri-8bebd54c6d63e3e500399f9737a0906de30dfbbe.tar.bz2 niri-8bebd54c6d63e3e500399f9737a0906de30dfbbe.zip | |
tile: Prepare for oscillating animations
Diffstat (limited to 'src/layout')
| -rw-r--r-- | src/layout/tile.rs | 7 |
1 files changed, 4 insertions, 3 deletions
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<W: LayoutElement> Tile<W> { .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<W: LayoutElement> Tile<W> { 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<W: LayoutElement> Tile<W> { 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() |
