diff --git a/src/app/command_driver.rs b/src/app/command_driver.rs index 7143e9ad1..3dbc3b3a2 100644 --- a/src/app/command_driver.rs +++ b/src/app/command_driver.rs @@ -688,6 +688,10 @@ impl OpenCADStudio { e.as_entity_mut().set_layer(layer.clone()); } } + // New layer changes the baked by-layer colour/linetype/ + // lineweight — re-tessellate the moved entities so they + // repaint immediately (issue #231 class). + self.invalidate_property_targets(i, &dest); self.tabs[i].dirty = true; self.command_line .push_info(&format!("Layer matched to \"{layer}\".")); diff --git a/src/app/commands/layerprops.rs b/src/app/commands/layerprops.rs index 0fb1d7504..7fb1abd00 100644 --- a/src/app/commands/layerprops.rs +++ b/src/app/commands/layerprops.rs @@ -128,6 +128,10 @@ impl OpenCADStudio { l.color = acadrust::types::Color::from_index(idx); self.push_undo_snapshot(i, "LAYER COLOR"); self.tabs[i].dirty = true; + // By-layer colour is baked into every wire on + // this layer — re-tessellate so they repaint + // immediately (issue #231 class). + self.tabs[i].scene.bump_geometry(); self.command_line.push_output(&format!( "LAYER: '{}' color set to ACI {}.", layer_name, idx diff --git a/src/app/commands/styleprops.rs b/src/app/commands/styleprops.rs index b1e0f353c..aca3ee836 100644 --- a/src/app/commands/styleprops.rs +++ b/src/app/commands/styleprops.rs @@ -413,6 +413,11 @@ impl OpenCADStudio { if changed > 0 { self.push_undo_snapshot(i, "CHPROP"); self.tabs[i].dirty = true; + // Colour / linetype / ltscale / transparency / + // layer are baked into the cached wire geometry — + // re-tessellate the changed entities so they + // repaint immediately (issue #231 class). + self.invalidate_property_targets(i, &handles); self.command_line.push_output(&format!( "CHPROP: {} entity/entities updated.", changed diff --git a/src/app/update/command.rs b/src/app/update/command.rs index 9004e67a2..e9fdca428 100644 --- a/src/app/update/command.rs +++ b/src/app/update/command.rs @@ -977,14 +977,18 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task { self.tabs[i].dirty = true; self.ribbon.active_layer = layer; } else { - // Apply to selection; leave the creation default alone - // (matches AutoCAD; "Make current" is a separate action). + // Apply to the selection; leave the creation default alone + // ("Make current" is a separate action). self.push_undo_snapshot(i, "CHPROP"); - for handle in handles { + for &handle in &handles { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer); } } + // Layer drives by-layer colour/linetype/lineweight, which are + // baked into the cached wire geometry — re-tessellate so the + // change shows immediately (issue #231 class). + self.invalidate_property_targets(i, &handles); self.tabs[i].dirty = true; self.ribbon.active_layer = layer; self.refresh_properties(); @@ -1041,11 +1045,15 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task { self.ribbon.active_linetype = lt; } else { self.push_undo_snapshot(i, "CHPROP"); - for handle in handles { + for &handle in &handles { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { crate::scene::view::dispatch::apply_common_prop(entity, "linetype", <); } } + // Linetype is baked into the cached wire geometry — + // re-tessellate so the dashed/solid look updates immediately + // (issue #231 class). + self.invalidate_property_targets(i, &handles); self.tabs[i].dirty = true; self.ribbon.active_linetype = lt; self.refresh_properties(); diff --git a/src/app/update/mod.rs b/src/app/update/mod.rs index 9b2a58c19..137794324 100644 --- a/src/app/update/mod.rs +++ b/src/app/update/mod.rs @@ -1971,11 +1971,15 @@ impl OpenCADStudio { self.ribbon.active_lineweight = lw; } else { self.push_undo_snapshot(i, "CHPROP"); - for handle in handles { + for &handle in &handles { if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) { crate::scene::view::dispatch::apply_line_weight(entity, lw); } } + // Lineweight is baked into the cached wire geometry — + // re-tessellate so the change shows immediately (issue #231 + // class). + self.invalidate_property_targets(i, &handles); self.tabs[i].dirty = true; self.ribbon.active_lineweight = lw; self.refresh_properties();