Panics · P32 Canvas: panels take their handlers in new; stale nodes, shapes, layers and topics change nothing

This commit is contained in:
ZacharyZhang-NY committed 2026-10-07 05:02:40 -04:00
1 parent 3741d5d5e8
commit ffe4f38103
27 files changed
+471 -297

No files matched your search

+13 -5
View File
@@ -221,18 +221,26 @@ pub fn mind(window: &mut Window, cx: &mut App) -> impl IntoElement + use<> {
change(&added, cx, |mind| {
mind.made += 1;
let key = SharedString::from(format!("idea-{}", mind.made));
mind.root = mind.root.adding(parent, Topic::new(key.clone(), "New idea"));
mind.selected = Some(key);
if let Some(root) = mind.root.adding(parent, Topic::new(key.clone(), "New idea")) {
mind.root = root;
mind.selected = Some(key);
}
})
})
.on_remove(move |key, _, cx| {
change(&removed, cx, |mind| {
mind.selected = mind.root.parent_of(key);
mind.root = mind.root.removing(key);
if let Some(root) = mind.root.removing(key) {
mind.selected = mind.root.parent_of(key);
mind.root = root;
}
})
})
.on_rename(move |key, text, _, cx| {
change(&renamed, cx, |mind| mind.root = mind.root.renaming(key, text.clone()))
change(&renamed, cx, |mind| {
if let Some(root) = mind.root.renaming(key, text.clone()) {
mind.root = root;
}
})
})
.on_viewport(move |next, _, cx| change(&viewed, cx, |mind| mind.view = next)),
cx,