tile: Prepare for oscillating animations
Browse files at this commit8bebd54c6d63e3e500399f9737a0906de30dfbbeParent: 1978e5b1 changed file +4 -3
- src/layout/tile.rs +4 -3
src/layout/tile.rsmodified+4 -3
| @@ -198,7 +198,8 @@ impl<W: LayoutElement> Tile<W> { | ||
| 198 | 198 | .open_animation |
| 199 | 199 | .as_ref() |
| 200 | 200 | .map(|anim| anim.value()) |
| 201 | - .unwrap_or(1.); | |
| 201 | + .unwrap_or(1.) | |
| 202 | + .max(0.); | |
| 202 | 203 | Size::from(((f64::from(size.w) * v).round() as i32, size.h)) |
| 203 | 204 | } |
| 204 | 205 | |
| @@ -356,7 +357,7 @@ impl<W: LayoutElement> Tile<W> { | ||
| 356 | 357 | renderer, |
| 357 | 358 | scale.x as i32, |
| 358 | 359 | &elements, |
| 359 | - anim.value() as f32, | |
| 360 | + anim.value().clamp(0., 1.) as f32, | |
| 360 | 361 | ); |
| 361 | 362 | self.window() |
| 362 | 363 | .set_offscreen_element_id(Some(elem.id().clone())); |
| @@ -369,7 +370,7 @@ impl<W: LayoutElement> Tile<W> { | ||
| 369 | 370 | RescaleRenderElement::from_element( |
| 370 | 371 | elem, |
| 371 | 372 | center.to_physical_precise_round(scale), |
| 372 | - (anim.value() / 2. + 0.5).min(1.), | |
| 373 | + (anim.value() / 2. + 0.5).max(0.), | |
| 373 | 374 | ), |
| 374 | 375 | )) |
| 375 | 376 | .into_iter() |