Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
7086517
Blocks palette: list/medium/large icon modes, visible-only preview ca…
Obtrusive8276 Oct 25, 2026
d9a0813
Address CodeRabbit review: repeat-placement tracking, Arc<Drawing> cl…
Obtrusive8276 Oct 25, 2026
07bd9c9
Keep repeat INSERT inside engine state machine and leave canvas hover…
Obtrusive8276 Oct 25, 2026
ac984d3
Handle Repeat/NoRepeat across all INSERT stages and bound preview wor…
Obtrusive8276 Oct 25, 2026
6b29569
Fix Blocks palette review findings and preflight polyline previews
Obtrusive8276 Oct 25, 2026
4cd4839
Merge main into blocks-palette-pr
Obtrusive8276 Oct 25, 2026
fbc9bbe
Merge main egui 0.37 migration into blocks palette
Obtrusive8276 Oct 25, 2026
bc5e0e1
Fix Blocks palette review findings and menu click ownership
Obtrusive8276 Oct 25, 2026
977077c
Restore bounded hatch thumbnails and exclude navigation clicks
Obtrusive8276 Oct 25, 2026
3091893
Support faithful hatch previews with shared work budget and bounded c…
Obtrusive8276 Oct 25, 2026
976bfb1
Allow checking Repeat placement while block insertion is already in p…
Obtrusive8276 Oct 25, 2026
7474b27
Address PR 2122 review feedback on hatch budget, ViewCube hit-testing…
Obtrusive8276 Oct 25, 2026
3a76df9
Charge leader and wipeout expansion and bound MLeader array inserts i…
Obtrusive8276 Oct 25, 2026
553d142
Charge MLeader paths in preview preflight and match ViewCube hit-test…
Obtrusive8276 Oct 25, 2026
dd937bb
Merge origin/main into blocks-palette-pr
Obtrusive8276 Oct 25, 2026
9d588a6
Allow block insertion while rename editor is open and clarify hatch p…
Obtrusive8276 Oct 25, 2026
c55c25e
Merge main into blocks palette PR preserving hatch budgets and docking
Obtrusive8276 Oct 26, 2026
9b27a39
Merge main into blocks palette PR after module layout refactor
Obtrusive8276 Oct 27, 2026
ce3cc2d
Limit palette repeat placement to palette-started insertions
Obtrusive8276 Oct 27, 2026
76d94bc
Account hatch preview comparisons as work occurs
Obtrusive8276 Oct 27, 2026
e66c267
Bound attribute thumbnail work and preserve palette rotation
Obtrusive8276 Oct 27, 2026
8fd4acd
Merge remote-tracking branch 'origin/main' into blocks-palette-pr
Obtrusive8276 Oct 27, 2026
1b2eb0c
Charge spline sampling work to the block preview budget
Obtrusive8276 Oct 27, 2026
ee07b7b
Charge splines at 1/32 of their sampling cap so ordinary blocks still…
Obtrusive8276 Oct 27, 2026
98f752f
Charge text lengths in block preview budget and preserve inline INSER…
Obtrusive8276 Oct 27, 2026
db2eb3c
Bound MText column metadata in block previews
Obtrusive8276 Oct 28, 2026
39f576a
Allow detailed block palette previews
Obtrusive8276 Oct 28, 2026
61f0d99
Explain refused block previews and keep them cached while scrolling
Obtrusive8276 Oct 28, 2026
4002656
Remove changes unrelated to the Blocks palette
Obtrusive8276 Oct 28, 2026
93abbda
Document the functions touched by the Blocks palette preview work
Obtrusive8276 Oct 28, 2026
fcd3c1d
Keep placement on unchanged rename and tighten palette click ownership
Obtrusive8276 Oct 28, 2026
7b77f48
Translate palette refusal messages and track canvas click ownership p…
Obtrusive8276 Oct 29, 2026
24f8d01
Treat navigation controls as release owners in batched canvas clicks
Obtrusive8276 Oct 29, 2026
acb22f1
Track INSERT ownership and refuse palette edits during a foreign INSERT
Obtrusive8276 Oct 29, 2026
621a6aa
Keep clicks on command-line keywords from placing canvas points
Obtrusive8276 Oct 29, 2026
f690cb5
Decide whether the ViewCube is shown from the current space, not the …
Obtrusive8276 Oct 29, 2026
ee1930d
Treat only a refused charge as hatch budget exhaustion
Obtrusive8276 Oct 29, 2026
eeaed55
Merge origin/main into blocks-palette-pr
Obtrusive8276 Oct 30, 2026
ebd33bc
Keep CLOSEALL's confirmation, widen the command-line click area, pers…
Obtrusive8276 Oct 30, 2026
d37ec6d
Merge origin/main into blocks-palette-pr
Obtrusive8276 Oct 30, 2026
67081db
Update Z and axis presets with a comma scale; grey the palette's Y sc…
Obtrusive8276 Oct 30, 2026
0584ada
Merge origin/main into blocks-palette-pr
Obtrusive8276 Oct 31, 2026
7ded84c
Fix doc comments on the BLOCK and ATTDEF input methods and the INSERT…
Obtrusive8276 Oct 31, 2026
e28aa8e
Merge origin/main into blocks-palette-pr
Obtrusive8276 Oct 31, 2026
8089c79
Reset the Verify counter between repeated INSERT placements
Obtrusive8276 Oct 31, 2026
f2ae408
Blocks palette: previews, block libraries and placement
Obtrusive8276 Nov 1, 2026
62bff60
Merge origin/main into blocks-palette-pr
Obtrusive8276 Nov 1, 2026
554126a
Blocks palette: read libraries off the UI thread, bound preview work
Obtrusive8276 Nov 1, 2026
c991862
Blocks palette: repeat a placement only after its own INSERT placed
Obtrusive8276 Nov 1, 2026
fcfc0cc
Blocks palette: a command started after a placement ends the repeat
Obtrusive8276 Nov 1, 2026
2964baa
INSERT: a cancelled placement takes no undo step
Obtrusive8276 Nov 1, 2026
6b94ce0
Merge main into blocks-palette-pr
Obtrusive8276 Nov 1, 2026
f53d540
Block import: keep what a block names and says about itself
Obtrusive8276 Nov 1, 2026
879f2a6
INSERT: Enter asks again at the insertion point, arrowheads follow re…
Obtrusive8276 Nov 1, 2026
bbec822
Block import and palette: keep every named style and layer, skip unus…
Obtrusive8276 Nov 1, 2026
4c8f7e2
Blocks palette: a quick right-click at the insertion point cancels th…
Obtrusive8276 Nov 2, 2026
08ae9ca
Merge main into blocks-palette-pr
Obtrusive8276 Nov 2, 2026
d38d10d
Blocks palette: a transparent command no longer stops Repeat Placement
Obtrusive8276 Nov 2, 2026
6c2fd4f
Blocks palette: a transparent command ending inside INSERT is not its…
Obtrusive8276 Nov 2, 2026
1ff9c02
Merge branch 'main' into blocks-palette-pr
Obtrusive8276 Nov 2, 2026
7a088fd
Blocks palette: BLOCKLIBIMPORT never replaces a block; BLOCKSPALETTE …
Obtrusive8276 Nov 2, 2026
5b8fb2a
Blocks palette: a library file must be named .dwg or .dxf
Obtrusive8276 Nov 2, 2026
c63fbcb
Blocks palette: library listing needs no drawing; a preview's two pas…
Obtrusive8276 Nov 2, 2026
e05b8de
Merge main into blocks-palette-pr
Obtrusive8276 Nov 3, 2026
03bf6a9
Blocks palette: a dimension override given as a number names its styl…
Obtrusive8276 Nov 3, 2026
a7fdd9b
Merge remote-tracking branch 'origin/main' into blocks-palette-pr
Obtrusive8276 Nov 3, 2026
7744807
Blocks palette: put show()'s doc comment back on show()
Obtrusive8276 Nov 3, 2026
5dc8bb4
Merge origin/main into blocks-palette-pr
Obtrusive8276 Nov 10, 2026
d8662ef
i18n(ka): add the 27 Blocks palette strings
Obtrusive8276 Nov 10, 2026
637f29b
Merge remote-tracking branch 'origin/main' into blocks-palette-pr
Obtrusive8276 Nov 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contributors/people.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,7 @@ sync_github_name = false
real_name = "Robert Lee"
sync_github_name = true


[people.Obtrusive8276]
display_name = "Nicopicks"
sync_github_name = false
98 changes: 94 additions & 4 deletions crates/engine/src/cmd/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,7 @@ impl Interactive for BlockM {
_ => self.sel.prompt(),
}
}
/// Feed user input into the interactive `INSERT` state machine.
fn input(&mut self, s: &mut Session, i: Input) -> Result<Step> {
match (&self.name, self.base) {
(None, _) if self.existing.is_some() => {
Expand Down Expand Up @@ -582,10 +583,14 @@ struct InsertM {
x_scale: Option<f64>,
scale: Option<Vec2>,
rotation: Option<f64>,
preset_scale: Option<Vec2>,
preset_rotation: Option<f64>,
attdefs: Vec<(String, String, String)>,
values: serde_json::Map<String, Value>,
/// `*name`: insert the block's objects (one uniform scale factor, no attribute values).
explode: bool,
/// Keep prompting for another insertion point after each placement until cancelled.
repeat: bool,
/// The file waiting for the Redefine answer.
file: Option<insert_file::FileRef>,
}
Expand All @@ -608,6 +613,15 @@ impl InsertM {
if self.explode {
insert_file::explode_insert(s, h)?;
}
if self.repeat {
self.at = None;
self.x_scale = None;
self.scale = self.preset_scale;
self.rotation = self.preset_rotation;
self.values.clear();
self.stage = InsStage::Point;
return Ok(Step::Continue);
}
return Ok(Step::Done);
}
Ok(Step::Continue)
Expand Down Expand Up @@ -680,7 +694,7 @@ impl Interactive for InsertM {
let name = self.file.as_ref().map(|f| f.name.clone()).unwrap_or_default();
Prompt::new(format!("Block \"{name}\" already exists. Redefine it?"), super::curves::KW).kw(&["Yes", "No"]).default("N")
}
InsStage::Point => Prompt::new("Specify insertion point", Accept::POINT).kw(&["Basepoint", "Scale", "Rotate"]),
InsStage::Point => Prompt::new("Specify insertion point", Accept::POINT).kw(&["Basepoint", "Scale", "Rotate", "Repeat", "NoRepeat"]),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
InsStage::BasePoint => Prompt::new("Specify base point", Accept::POINT),
InsStage::PresetScale => Prompt::new("Specify scale factor for XYZ axes", Accept::NUMBER).default("1"),
InsStage::PresetRotation => Prompt::new("Specify rotation angle", Accept::NUMBER).default("0"),
Expand All @@ -696,7 +710,18 @@ impl Interactive for InsertM {
}
}
}
/// Feed user input into the interactive `INSERT` state machine.
fn input(&mut self, s: &mut Session, i: Input) -> Result<Step> {
if let Input::Keyword(k) = &i {
if k == "Repeat" {
self.repeat = true;
return Ok(Step::Continue);
}
if k == "NoRepeat" {
self.repeat = false;
return Ok(Step::Continue);
}
}
match self.stage {
InsStage::Name => {
let n = match i {
Expand Down Expand Up @@ -748,24 +773,40 @@ impl Interactive for InsertM {
}
}
InsStage::PresetScale => {
if let Input::Text(t) = &i
&& let Some((x, y)) = t.split_once(',').filter(|_| !self.explode)
{
let sc = Vec2::new(nonzero(x.trim())?, nonzero(y.trim())?);
self.scale = Some(sc);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
if self.at.is_some() {
return self.advance(s);
}
self.preset_scale = Some(sc);
self.stage = InsStage::Point;
return Ok(Step::Continue);
}
let f = match i {
Input::Text(t) => nonzero(&t)?,
Input::Enter => 1.0,
_ => return Ok(Step::Continue),
};
self.scale = Some(Vec2::new(f, f));
let sc = Vec2::new(f, f);
self.scale = Some(sc);
// Exploded insertion asks its one scale factor after the insertion point.
if self.at.is_some() {
return self.advance(s);
}
self.preset_scale = Some(sc);
self.stage = InsStage::Point;
}
InsStage::PresetRotation => {
self.rotation = Some(match i {
let rot = match i {
Input::Text(t) => s.angle_settings().direction(&t).ok_or_else(|| EngineError::Other("Requires an angle.".into()))?,
Input::Enter => 0.0,
_ => return Ok(Step::Continue),
});
};
self.rotation = Some(rot);
self.preset_rotation = Some(rot);
self.stage = InsStage::Point;
}
InsStage::XScale => match i {
Expand Down Expand Up @@ -858,6 +899,7 @@ impl Interactive for AttdefM {
_ => Prompt::new("Specify start point of text", Accept::POINT),
}
}
/// Feed user input into the interactive `INSERT` state machine.
fn input(&mut self, s: &mut Session, i: Input) -> Result<Step> {
let text = match &i {
Input::Text(t) => Some(t.clone()),
Expand Down Expand Up @@ -888,3 +930,51 @@ impl Interactive for AttdefM {
mod attribs;
mod battman;
mod blockreplace;

#[cfg(test)]
mod tests {
use super::*;

/// Verify that the interactive `INSERT` prompt advertises `Repeat` and `NoRepeat`, and that
/// `NoRepeat` disarms repeat placement at any stage without answering scale or rotation prompts.
#[test]
fn interactive_insert_accepts_repeat_and_norepeat_across_stages() {
let mut s = Session::new();
s.execute("line", &serde_json::json!({ "points": [[0, 0], [5, 0]] })).unwrap();
s.execute("block", &serde_json::json!({ "name": "B1", "base": [0, 0], "keep": "delete", "handles": ["100"] })).unwrap();

s.start("insert").unwrap();
s.input(Input::Text("B1".into())).unwrap();
let p = s.current_prompt().unwrap();
assert!(p.keywords.iter().any(|k| k == "Repeat"));
assert!(p.keywords.iter().any(|k| k == "NoRepeat"));

// Complete a placement and verify Repeat returns INSERT to the insertion-point prompt.
s.cmdline("Repeat").unwrap();
s.input(Input::Point(Vec2::new(10.0, 0.0))).unwrap();
s.input(Input::Enter).unwrap(); // X scale
s.input(Input::Enter).unwrap(); // Y scale
s.input(Input::Text("0".into())).unwrap(); // Rotation
assert_eq!(s.running.as_ref().map(|r| r.id.as_str()), Some("insert"));
assert!(s.current_prompt().unwrap().accept.point);
assert_eq!(s.current_prompt().unwrap().message, "Specify insertion point");
assert_eq!(s.doc().unwrap().model.len(), 1);
s.cancel();

// Start INSERT, enable Repeat, pick insertion point, then disarm Repeat with NoRepeat during Rotation stage.
s.start("insert").unwrap();
s.cmdline("B1").unwrap();
s.cmdline("Repeat").unwrap();
s.input(Input::Point(Vec2::new(10.0, 0.0))).unwrap();
s.input(Input::Enter).unwrap(); // X scale = 1
s.input(Input::Enter).unwrap(); // Y scale = 1 -> now at Rotation stage
assert!(s.current_prompt().unwrap().message.contains("rotation"));
// Sending NoRepeat at the Rotation stage must not answer the rotation prompt or place the block yet.
s.input(Input::Keyword("NoRepeat".into())).unwrap();
assert!(s.running.is_some());
assert!(s.current_prompt().unwrap().message.contains("rotation"));
// Answering rotation now places the block and finishes INSERT because repeat was disarmed.
s.input(Input::Text("45".into())).unwrap();
assert!(s.running.is_none());
}
}
1 change: 1 addition & 0 deletions crates/io/src/pdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ fn sheet(d: &Drawing, space: &Space, o: &PdfOptions, links_to: &[(Handle, String
min_dash: 0.0,
text: true,
fill: true,
hatch_budget: None,
lineweights,
view_height: 0.0,
plot_style_table,
Expand Down
21 changes: 18 additions & 3 deletions crates/render/src/fill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,21 @@ use cadcraft_geom::{Polyline, Vec2};
/// crossing and each part is paired on its own. Robust for any input; output size is
/// O(slabs × crossings), capped for hostile inputs.
pub fn triangulate_evenodd(loops: &[Vec<Vec2>]) -> Vec<Vec2> {
triangulate_evenodd_limited(loops, None).unwrap_or_default()
}

/// Budgeted triangulation discards incomplete fills instead of displaying partial geometry.
pub(crate) fn triangulate_evenodd_limited(loops: &[Vec<Vec2>], budget: Option<&crate::hatch::HatchBudget>) -> Option<Vec<Vec2>> {
use crate::hatch::charge;
if !charge(budget, loops.len()) {
return None;
}
let mut edges: Vec<(Vec2, Vec2)> = Vec::new();
for l in loops {
let n = l.len();
if !charge(budget, n.saturating_mul(16)) {
return None;
}
if n < 3 {
continue;
}
Expand All @@ -23,7 +35,7 @@ pub fn triangulate_evenodd(loops: &[Vec<Vec2>]) -> Vec<Vec2> {
}
}
if edges.is_empty() || edges.len() > 200_000 {
return Vec::new();
return Some(Vec::new());
}
let mut ys: Vec<f64> = edges.iter().flat_map(|(a, b)| [a.y, b.y]).collect();
ys.sort_by(f64::total_cmp);
Expand Down Expand Up @@ -51,6 +63,9 @@ pub fn triangulate_evenodd(loops: &[Vec<Vec2>]) -> Vec<Vec2> {
pending.clear();
pending.push((y0, y1));
while let Some((ya, yb)) = pending.pop() {
if !charge(budget, active.len().saturating_mul(16).saturating_add(1)) {
return None;
}
let ymid = (ya + yb) / 2.0;
let mut xs: Vec<(f64, f64, f64)> = active.iter().map(|e| (x_at(e, ymid), x_at(e, ya), x_at(e, yb))).collect();
xs.sort_by(|a, b| a.0.total_cmp(&b.0));
Expand Down Expand Up @@ -84,11 +99,11 @@ pub fn triangulate_evenodd(loops: &[Vec<Vec2>]) -> Vec<Vec2> {
}
}
if out.len() > 6_000_000 {
return out;
return Some(out);
}
}
}
out
Some(out)
}

/// How many extra slab boundaries crossings may add over one region.
Expand Down
Loading