1
0
Fork 0
forked from wry/wry

Constrain mono boundary animations

This commit is contained in:
atagen 2026-05-22 09:22:07 +10:00
parent 0fefe814c3
commit d2138b45f6
2 changed files with 14 additions and 4 deletions

View file

@ -132,6 +132,7 @@ pub struct ContainerNode {
pub sum_factors: Cell<f64>,
pub layout_scheduled: Cell<bool>,
animate_next_layout: Cell<bool>,
pub mono_transition_animation_pending: Cell<bool>,
compute_render_positions_scheduled: Cell<bool>,
num_children: NumCell<usize>,
pub children: LinkedList<ContainerChild>,
@ -240,6 +241,7 @@ impl ContainerNode {
sum_factors: Cell::new(1.0),
layout_scheduled: Cell::new(false),
animate_next_layout: Cell::new(false),
mono_transition_animation_pending: Cell::new(false),
compute_render_positions_scheduled: Cell::new(false),
num_children: NumCell::new(1),
children,
@ -473,6 +475,7 @@ impl ContainerNode {
fn perform_layout(self: &Rc<Self>) {
self.layout_scheduled.set(false);
if self.num_children.get() == 0 {
self.mono_transition_animation_pending.set(false);
return;
}
if let Some(child) = self.mono_child.get() {
@ -490,6 +493,7 @@ impl ContainerNode {
self.damage();
}
}
self.mono_transition_animation_pending.set(false);
}
fn perform_mono_layout(self: &Rc<Self>, child: &ContainerChild) {
@ -823,6 +827,7 @@ impl ContainerNode {
}
}
self.mono_child.set(child.clone());
self.mono_transition_animation_pending.set(true);
if child.is_some() {
self.rebuild_tab_bar();
} else {

View file

@ -204,17 +204,22 @@ impl<T: ToplevelNodeBase> ToplevelNode for T {
&& !data.is_fullscreen.get()
&& data.kind.is_app_window()
&& !self.node_is_container();
let parent_is_mono = data
let parent_container = data
.parent
.get()
.and_then(|parent| parent.node_into_container())
.and_then(|parent| parent.node_into_container());
let parent_is_mono = parent_container
.as_ref()
.is_some_and(|container| container.mono_child.is_some());
let parent_mono_transition = parent_container
.as_ref()
.is_some_and(|container| container.mono_transition_animation_pending.get());
let active_mono_boundary = matches!(
hierarchy.transition,
MultiphaseHierarchyTransition::EnteringMono
| MultiphaseHierarchyTransition::ExitingMono
) && (hierarchy.source.mono_active
|| hierarchy.target.mono_active);
) && parent_mono_transition
&& (hierarchy.source.mono_active || hierarchy.target.mono_active);
if prev != *rect
&& !prev.is_empty()
&& !rect.is_empty()