diff --git a/COMMANDS.md b/COMMANDS.md index 8c5f914d3..c19313a29 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -243,8 +243,6 @@ Status of every standard CAD command in Open CAD Studio: | `ZOOM` | Z | Zoom | ✅ | | `PAN` | P | Pan | ✅ | | `ORBIT` | 3DO | 3D orbit | ✅ | -| `REGEN` | RE | Regenerate drawing | ✅ | -| `REDRAW` | R | Redraw viewport | ✅ | | `VPORTS` | — | Viewport configuration | ✅ | | `VPJOIN` | — | Join viewports | ✅ | | `SYNCPVIEWPORTS` | VPSYNC | Sync viewport display settings | ✅ | diff --git a/src/app/command_driver.rs b/src/app/command_driver.rs index 3d4d08a95..7b2f816d0 100644 --- a/src/app/command_driver.rs +++ b/src/app/command_driver.rs @@ -764,6 +764,10 @@ impl OpenCADStudio { } } self.tabs[i].dirty = true; + // Color / linetype / lineweight are baked into the cached + // wires at tessellation time; bump the geometry epoch so the + // matched objects repaint instead of holding their old look. + self.tabs[i].scene.bump_geometry(); self.refresh_properties(); self.command_line .push_info(&format!("Properties matched to {} object(s).", dest.len())); diff --git a/src/app/commands/display.rs b/src/app/commands/display.rs index f6df8dd2d..19172bf98 100644 --- a/src/app/commands/display.rs +++ b/src/app/commands/display.rs @@ -3,12 +3,6 @@ use super::*; impl OpenCADStudio { pub(super) fn dispatch_display(&mut self, cmd: &str, i: usize) -> Option> { match cmd { - // ── Display refresh (no-op in GPU raster pipeline) ──────────────── - "REGEN" | "REGENALL" | "REDRAW" | "REDRWALL" => { - // Display is always up-to-date in the GPU raster pipeline. - self.command_line.push_output("Display regenerated."); - } - // Interactive pan: left-drag pans the view until Esc. The only pan // path when there is no middle mouse button (trackpad / web). "PAN" | "P" => { diff --git a/src/app/commands/mod.rs b/src/app/commands/mod.rs index cf9e58b34..6fc0f76e8 100644 --- a/src/app/commands/mod.rs +++ b/src/app/commands/mod.rs @@ -511,10 +511,6 @@ inventory::submit!(crate::command::CommandRegistration { "QSELECT", "QUIT", "REDO", - "REDRAW", - "REDRWALL", - "REGEN", - "REGENALL", "RENAME", "REPORT", "SA", diff --git a/src/app/update/mod.rs b/src/app/update/mod.rs index 526476e2c..35a4171f5 100644 --- a/src/app/update/mod.rs +++ b/src/app/update/mod.rs @@ -964,6 +964,10 @@ impl OpenCADStudio { pl.color = new_color; } self.tabs[i].dirty = true; + // ByLayer color is baked into the cached wires at + // tessellation time, so bump the geometry epoch to + // invalidate the wire cache and repaint with the new color. + self.tabs[i].scene.bump_geometry(); } self.tabs[i].layers.color_picker_row = None; self.tabs[i].layers.color_full_palette = false; @@ -984,6 +988,8 @@ impl OpenCADStudio { pl.linetype = lt; } self.tabs[i].dirty = true; + // Linetype is baked into the cached wires; repaint. + self.tabs[i].scene.bump_geometry(); } } Task::none() @@ -1001,6 +1007,8 @@ impl OpenCADStudio { pl.lineweight = lw; } self.tabs[i].dirty = true; + // Lineweight is baked into the cached wires; repaint. + self.tabs[i].scene.bump_geometry(); } } Task::none() diff --git a/src/scene/view/render.rs b/src/scene/view/render.rs index 4f1d56aea..8d5ea1d13 100644 --- a/src/scene/view/render.rs +++ b/src/scene/view/render.rs @@ -1148,6 +1148,23 @@ mod layer0_inherit_tests { assert_eq!(&c[..3], &ins[..3], "ByBlock child uses the insert's color"); } + // A *top-level* (non-block-child) entity on layer 0 with ByLayer colour + // resolves layer 0's own colour and follows it when the layer is recoloured. + // Regression guard for the issue 231 layer-0 repaint path. + #[test] + fn toplevel_layer0_bylayer_follows_layer_color() { + let mut d = doc(); + let e = child("0", Color::ByLayer); + let before = render_style_for(&d, &e).0; + if let Some(l) = d.layers.get_mut("0") { + l.color = Color::Index(3); // recolour layer 0 -> green + } + let after = render_style_for(&d, &e).0; + let green = tess_util::aci_to_rgba(&Color::Index(3)); + assert_eq!(&after[..3], &green[..3], "top-level layer-0 ByLayer must follow layer 0's colour"); + assert_ne!(&before[..3], &after[..3], "colour must change after recolour"); + } + #[test] fn explicit_color_wins_even_on_layer0() { let d = doc();