Hide the old element on attach to grid

This commit is contained in:
hodasemi 2024-04-22 07:36:28 +02:00
parent bb27a8cda0
commit 75e92513fe

View file

@ -375,6 +375,19 @@ impl Grid {
let weak = child_state.downgrade(); let weak = child_state.downgrade();
// disable the old element
match &grid[pos_x][pos_y] {
ChildState::Some { child, .. } => {
if self.visible() {
if let Some(child_visibility) = child.visibility() {
child_visibility.set_visibility(false)?;
}
}
}
ChildState::Extend { .. } => todo!(),
ChildState::None => (),
}
// insert the element // insert the element
for x in pos_x..(pos_x + dim_x as usize) { for x in pos_x..(pos_x + dim_x as usize) {
for y in pos_y..(pos_y + dim_y as usize) { for y in pos_y..(pos_y + dim_y as usize) {