🐛 Fix grid layout lines persisted after board is deleted

This commit is contained in:
Belén Albeza 2026-02-17 12:58:15 +01:00
parent 7ef16a2b69
commit 4185a7a6f3
4 changed files with 21 additions and 0 deletions

View File

@ -412,6 +412,9 @@ fn set_children_set(entries: Vec<Uuid>) {
for id in entries {
state.touch_shape(id);
if let Some(children_shape) = state.shapes.get_mut(&id) {
children_shape.set_deleted(false);
}
}
});

View File

@ -45,6 +45,10 @@ pub fn render(render_state: &mut RenderState, shapes: ShapesPoolRef) {
continue;
}
if shape.deleted() {
continue;
}
if let Some(shape) = shapes.get(&shape.id) {
grid_layout::render_overlay(zoom, canvas, shape, shapes);
}

View File

@ -196,6 +196,7 @@ pub struct Shape {
pub extrect_cache: RefCell<Option<(math::Rect, u32)>>,
pub svg_transform: Option<Matrix>,
pub ignore_constraints: bool,
deleted: bool,
}
// Returns all ancestor shapes of this shape, traversing up the parent hierarchy
@ -284,6 +285,7 @@ impl Shape {
extrect_cache: RefCell::new(None),
svg_transform: None,
ignore_constraints: false,
deleted: false,
}
}
@ -441,6 +443,14 @@ impl Shape {
self.svg_transform
}
pub fn set_deleted(&mut self, value: bool) {
self.deleted = value;
}
pub fn deleted(&self) -> bool {
self.deleted
}
// FIXME: These arguments could be grouped or simplified
#[allow(clippy::too_many_arguments)]
pub fn set_flex_layout_child_data(

View File

@ -157,6 +157,10 @@ impl State {
self.render_state.tiles.remove_shape_at(tile, shape.id);
}
}
if let Some(shape_to_delete) = self.shapes.get_mut(&id) {
shape_to_delete.set_deleted(true);
}
}
}