mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-21 02:01:55 +07:00
Use clamped animations where it makes sense
This commit is contained in:
@@ -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
@@ -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()));
|
||||
|
||||
@@ -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.)
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user