forked from 1b-agent/fieldcraft-upstream
ui: a new document clears the viewport's picks; opening a sample says so
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UhhZMBTviDQxZvwnyP89fo
This commit is contained in:
1 parent
b89efb55c1
commit
47bdbf981d
2 files changed
+10
No files matched your search
@@ -1404,6 +1404,11 @@ impl ModelApp {
|
||||
self.selected = None;
|
||||
self.selected_seed = None;
|
||||
self.reply = None;
|
||||
// Picks are by name, and the names of another document are other things.
|
||||
if !self.pick.selection.is_empty() {
|
||||
self.pick.selection.clear();
|
||||
self.pick.generation = self.pick.generation.wrapping_add(1);
|
||||
}
|
||||
}
|
||||
self.framed_document = Some(self.session.opened());
|
||||
self.reframe = framing::Reframe::merge(self.reframe, framing::Reframe::Home);
|
||||
@@ -1748,6 +1753,7 @@ mod tests {
|
||||
app.run("file.sample", json!({"name": "cantilever"})).unwrap();
|
||||
assert_eq!(app.model_name(), "Cantilever (sample)");
|
||||
let status = |app: &ModelApp| app.status.as_ref().map(|s| s.text.clone()).unwrap_or_default();
|
||||
assert_eq!(status(&app), "Opened the Cantilever sample");
|
||||
app.run("solve.run", json!({})).unwrap();
|
||||
assert_eq!(status(&app), "Solved 2 steps");
|
||||
app.run("results.deformed", json!({"step": "Load", "show": true})).unwrap();
|
||||
|
||||
@@ -112,6 +112,10 @@ pub fn done(command: &str, label: &str, params: &Value, v: &Value) -> String {
|
||||
None => format!("Showing {step}, last frame"),
|
||||
}),
|
||||
"results.clear" => Some("Back to the model".to_string()),
|
||||
"file.sample" => {
|
||||
let label = v.get("sample").and_then(Value::as_str).and_then(fieldcraft_engine::sample::find).map(|s| s.label);
|
||||
label.map(|l| format!("Opened the {l} sample"))
|
||||
}
|
||||
"solve.run" => v.get("steps").and_then(Value::as_array).map(|s| format!("Solved {}", plural(s.len() as u64, "step"))),
|
||||
c if c.starts_with("solve.") => Some(format!("Solved {step}", step = params["step"].as_str().unwrap_or("the step"))),
|
||||
_ => None,
|
||||
|
||||
Reference in new issue
Block a user