Skip to content

Commit cf26fe1

Browse files
committed
tiling: Fix flicker during resizing
1 parent e217a91 commit cf26fe1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/shell/layout/tiling/mod.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3965,9 +3965,17 @@ impl TilingLayout {
39653965
.then(|| &self.queue.trees.front().unwrap().0);
39663966

39673967
let percentage = if let Some(animation_start) = self.queue.animation_start {
3968-
let percentage = Instant::now().duration_since(animation_start).as_millis() as f32
3969-
/ duration.as_millis() as f32;
3970-
ease(EaseInOutCubic, 0.0, 1.0, percentage)
3968+
if *duration == Duration::ZERO {
3969+
1.0
3970+
} else {
3971+
let now = Instant::now();
3972+
let total = duration.as_millis() as f32;
3973+
let since = now.duration_since(animation_start).as_millis() as f32;
3974+
let percentage = since / total;
3975+
debug_assert!(!percentage.is_nan());
3976+
debug_assert!(!percentage.is_infinite());
3977+
ease(EaseInOutCubic, 0.0, 1.0, percentage)
3978+
}
39713979
} else {
39723980
1.0
39733981
};

0 commit comments

Comments
 (0)