From d515b1fb961544d7750c054ffc47ed3aa1be46bc Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 18 Nov 2026 12:30:12 -0800 Subject: [PATCH] Dimension tool: the dimension reads stop at the 20,000-object limit The walks that look for dimension ends and lines to snap to, and the dimension lines a linear dimension lines up with, stop going through the remaining layers and siblings once they have read 20,000 objects. --- crates/tools/src/dimension.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/tools/src/dimension.rs b/crates/tools/src/dimension.rs index 97801b50fe..12e8bdc458 100644 --- a/crates/tools/src/dimension.rs +++ b/crates/tools/src/dimension.rs @@ -270,6 +270,9 @@ fn on_dimensions(cx: &ToolContext, p: Point) -> Option<(Point, bool)> { } } for c in n.children().into_iter().flatten().rev() { + if *budget == 0 { + return; + } lines(c, measured, p, reach, budget, best); } } @@ -284,6 +287,9 @@ fn on_dimensions(cx: &ToolContext, p: Point) -> Option<(Point, bool)> { return; } for c in n.children().into_iter().flatten().rev() { + if *budget == 0 { + return; + } visit(c, p, reach, budget, best); } } @@ -292,6 +298,9 @@ fn on_dimensions(cx: &ToolContext, p: Point) -> Option<(Point, bool)> { } let (reach, mut budget, mut best) = ([cx.tol(ANCHOR_REACH), cx.tol(8.0)], 20_000usize, Best::default()); for n in cx.doc.layers.iter().rev() { + if budget == 0 { + break; + } visit(n, p, reach, &mut budget, &mut best); } best.end.map(|(_, q)| (q, true)).or_else(|| best.line.map(|(_, q)| (q, false))) @@ -318,11 +327,17 @@ fn dimension_lines(cx: &ToolContext, preview: (u64, [Point; 2])) -> Vec