forked from 1b-agent/opencadstudio-upstream
fix(pdf): per-piece snap bounds, linear image layering, snap op checks
Review of #1484: - The underlay's snap geometry became one hidden wire per segment, but every piece took the whole page's bounding box, so each cursor move visited every piece. Each piece now gets its own box. - Assigning unlayered images to the last layer compared Debug strings of every layered path and text per drawn item (quadratic, formatted anew each time); the owners are keyed once in a map. - The `snap` automation op used (0, 0, 0) for a missing point; it now answers invalid_point. It also left the live snapper's base point set to the query's; the base point is restored. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fc48087e50
commit
7e90d4d1a1
4 files changed
+23
-15
No files matched your search
@@ -708,13 +708,12 @@ impl OpenCADStudio {
|
||||
"measure" => self.control_measure(&req),
|
||||
// The object snap a cursor over `point` (world) would get;
|
||||
// `from` is the base for perpendicular and tangent.
|
||||
"snap" => {
|
||||
"snap" => 'snap: {
|
||||
let p = &req["point"];
|
||||
let world = glam::DVec3::new(
|
||||
p[0].as_f64().unwrap_or(0.0),
|
||||
p[1].as_f64().unwrap_or(0.0),
|
||||
p[2].as_f64().unwrap_or(0.0),
|
||||
);
|
||||
let (Some(x), Some(y)) = (p[0].as_f64(), p[1].as_f64()) else {
|
||||
break 'snap failure("invalid_point", "point must be [x, y] or [x, y, z]");
|
||||
};
|
||||
let world = glam::DVec3::new(x, y, p[2].as_f64().unwrap_or(0.0));
|
||||
let from = req["from"].as_array().map(|f| {
|
||||
glam::DVec3::new(
|
||||
f.first().and_then(|v| v.as_f64()).unwrap_or(0.0),
|
||||
|
||||
Reference in new issue
Block a user