applets: Fix panics moving only applet in 'Start' to 'Center'

This commit is contained in:
Ian Douglas Scott 2023-12-27 15:11:27 -08:00 committed by Ashley Wulber
parent e534f7b151
commit f97833543b

View file

@ -936,7 +936,7 @@ where
} }
fn diff(&mut self, tree: &mut Tree) { fn diff(&mut self, tree: &mut Tree) {
self.inner.as_widget_mut().diff(&mut tree.children[0]); tree.diff_children(&mut [&mut self.inner]);
} }
fn width(&self) -> Length { fn width(&self) -> Length {
@ -1001,7 +1001,8 @@ where
event::Status::Ignored => event::Status::Ignored, event::Status::Ignored => event::Status::Ignored,
}; };
let height = (layout.bounds().height - SPACING * (self.info.len() - 1) as f32) let height = (layout.bounds().height
- SPACING * (self.info.len().saturating_sub(1)) as f32)
/ self.info.len() as f32; / self.info.len() as f32;
let state = tree.state.downcast_mut::<ReorderWidgetState>(); let state = tree.state.downcast_mut::<ReorderWidgetState>();