1
0
Fork 0
forked from wry/wry

Add retained spawn-out animations

This commit is contained in:
atagen 2026-05-21 17:09:06 +10:00
parent d0cc5dc3c7
commit fa5c28ca3d
9 changed files with 331 additions and 8 deletions

View file

@ -3,8 +3,8 @@ use {
acceptor::Acceptor,
allocator::BufferObject,
animation::{
AnimationCurve, AnimationState, AnimationTick, RetainedToplevel, expand_damage_rect,
spawn_in_start_rect,
AnimationCurve, AnimationState, AnimationTick, RetainedExitLayer, RetainedToplevel,
expand_damage_rect, spawn_in_start_rect,
},
async_engine::{AsyncEngine, SpawnedFuture},
backend::{
@ -1572,6 +1572,36 @@ impl State {
}
}
pub fn queue_spawn_out_animation(
self: &Rc<Self>,
from: Rect,
frame_inset: i32,
retained: Rc<RetainedToplevel>,
active: bool,
layer: RetainedExitLayer,
) {
if !self.animations.enabled.get() || from.is_empty() {
return;
}
let now = self.now_nsec();
let started = self.animations.set_spawn_out(
from,
frame_inset,
retained,
active,
layer,
now,
self.animations.duration_ms.get(),
);
if started {
self.damage(expand_damage_rect(
from,
self.theme.sizes.border_width.get().max(0),
));
self.ensure_animation_tick();
}
}
pub fn set_animations_enabled(&self, enabled: bool) {
if self.animations.enabled.replace(enabled) && !enabled {
self.animations.clear();