Use clamped animations where it makes sense

This commit is contained in:
Ivan Molodetskikh
2024-04-10 11:28:49 +04:00
parent 0c68609063
commit 5383a0591f
4 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -125,7 +125,7 @@ impl ClosingWindow {
}
pub fn are_animations_ongoing(&self) -> bool {
!self.anim.is_done()
!self.anim.is_clamped_done()
}
pub fn render(
@@ -134,7 +134,7 @@ impl ClosingWindow {
scale: Scale<f64>,
target: RenderTarget,
) -> ClosingWindowRenderElement {
let val = self.anim.value();
let val = self.anim.clamped_value();
let block_out = match self.block_out_from {
None => false,
+1 -1
View File
@@ -387,7 +387,7 @@ impl<W: LayoutElement> Tile<W> {
renderer,
scale.x as i32,
&elements,
anim.value().clamp(0., 1.) as f32,
anim.clamped_value().clamp(0., 1.) as f32,
);
self.window()
.set_offscreen_element_id(Some(elem.id().clone()));
+4 -2
View File
@@ -956,8 +956,10 @@ impl<W: LayoutElement> Workspace<W> {
// FIXME: this is a bit cursed since it's relying on Tile's internal details.
let (starting_alpha, starting_scale) = if let Some(anim) = tile.open_animation() {
let val = anim.value();
(val.clamp(0., 1.) as f32, (val / 2. + 0.5).max(0.))
(
anim.clamped_value().clamp(0., 1.) as f32,
(anim.value() / 2. + 0.5).max(0.),
)
} else {
(1., 1.)
};
+1 -3
View File
@@ -119,9 +119,7 @@ impl ConfigErrorNotification {
}
State::Hiding(anim) => {
anim.set_current_time(target_presentation_time);
// HACK: prevent bounciness on hiding. This is better done with a clamp property on
// the spring animation.
if anim.is_done() || anim.value() <= 0. {
if anim.is_clamped_done() {
self.state = State::Hidden;
}
}