fix: apply horizontal and vertical constraints to preselection

This commit is contained in:
lillith committed 2026-10-11 18:51:34 +02:00
1 parent d9d4dd262d
commit 09bf9cafdf
3 files changed
+109

No files matched your search

+15
View File
@@ -545,6 +545,21 @@ impl SolveApp {
self.last_command = Some((spec.id.to_string(), spec.label.to_string()));
}
if let Some(mut t) = tools::Tool::for_command(id) {
if id == "sketch.constraint.horizontal_vertical" {
use solvecraft_engine::Sel;
let params = match self.session.selection.as_slice() {
[Sel::SketchCurve { id }] => Some(json!({ "line": id })),
[Sel::SketchPoint { id: a }, Sel::SketchPoint { id: b }] if a != b => Some(json!({ "points": [a, b] })),
_ => None,
};
if let Some(params) = params {
if self.run(id, params).is_ok() {
let _ = self.session.execute("select.clear", &json!({}));
self.set_status("Constraint applied", false);
}
return;
}
}
// Curve-pair constraints can consume an exact preselection. Leave ambiguous
// selections to the ordinary pick tool; never silently constrain a subset.
if matches!(