Canvas · Graphs and boards: a field hands focus back on Enter and Escape

writing::begin records the owner's focus, the mind map's or the tool
layer's, through forms::Editing::returning. The field keeps its words on
Enter's release and drops them on Escape, and both hand focus back, so
the map's arrows and the board's Backspace work at once after a write.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-27 08:41:05 -04:00
1 parent 538c3ed93f
commit 31bd483dc5
8 files changed
+81 -12

No files matched your search

+15 -3
View File
@@ -125,15 +125,27 @@ impl RenderOnce for MindMap {
);
}
let rename = {
let (editing, placed, on_rename) =
(editing.clone(), placed.clone(), self.on_rename.clone());
let (editing, placed, on_rename, home) = (
editing.clone(),
placed.clone(),
self.on_rename.clone(),
focus.clone(),
);
move |key: &SharedString, window: &mut Window, cx: &mut App| {
let topic = placed
.iter()
.find(|topic| topic.key == *key)
.expect("a placed topic");
let words = topic.text.to_string();
writing::begin(&editing, key.clone(), words, on_rename.clone(), window, cx);
writing::begin(
&editing,
key.clone(),
words,
on_rename.clone(),
home.clone(),
window,
cx,
);
}
};
let rename = Rc::new(rename);