fix(properties): repaint on linetype/lineweight/layer edits (#231 class)
Color/linetype/lineweight/layer are baked into the cached wire geometry at tessellation time, so a property edit only repaints if the handler bumps the geometry epoch. The color path did; several siblings only set tabs.dirty (a save flag) and never re-tessellated, leaving the viewport showing the stale look. Route every handle-based edit through invalidate_property_targets (mark dirty + recolor meshes + bump geometry), and full-bump the name-based LAYER COLOR change: - ribbon layer / linetype / lineweight dropdowns applied to a selection - CHPROP (color/linetype/ltscale/transparency/layer) - LAYMATCH (MatchEntityLayer) - LAYER COLOR <name> <aci> Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
18fff5cf8c
commit
7f3ebde663
5 changed files with 30 additions and 5 deletions
|
|
@ -688,6 +688,10 @@ impl OpenCADStudio {
|
||||||
e.as_entity_mut().set_layer(layer.clone());
|
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.tabs[i].dirty = true;
|
||||||
self.command_line
|
self.command_line
|
||||||
.push_info(&format!("Layer matched to \"{layer}\"."));
|
.push_info(&format!("Layer matched to \"{layer}\"."));
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,10 @@ impl OpenCADStudio {
|
||||||
l.color = acadrust::types::Color::from_index(idx);
|
l.color = acadrust::types::Color::from_index(idx);
|
||||||
self.push_undo_snapshot(i, "LAYER COLOR");
|
self.push_undo_snapshot(i, "LAYER COLOR");
|
||||||
self.tabs[i].dirty = true;
|
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!(
|
self.command_line.push_output(&format!(
|
||||||
"LAYER: '{}' color set to ACI {}.",
|
"LAYER: '{}' color set to ACI {}.",
|
||||||
layer_name, idx
|
layer_name, idx
|
||||||
|
|
|
||||||
|
|
@ -413,6 +413,11 @@ impl OpenCADStudio {
|
||||||
if changed > 0 {
|
if changed > 0 {
|
||||||
self.push_undo_snapshot(i, "CHPROP");
|
self.push_undo_snapshot(i, "CHPROP");
|
||||||
self.tabs[i].dirty = true;
|
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!(
|
self.command_line.push_output(&format!(
|
||||||
"CHPROP: {} entity/entities updated.",
|
"CHPROP: {} entity/entities updated.",
|
||||||
changed
|
changed
|
||||||
|
|
|
||||||
|
|
@ -977,14 +977,18 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||||
self.tabs[i].dirty = true;
|
self.tabs[i].dirty = true;
|
||||||
self.ribbon.active_layer = layer;
|
self.ribbon.active_layer = layer;
|
||||||
} else {
|
} else {
|
||||||
// Apply to selection; leave the creation default alone
|
// Apply to the selection; leave the creation default alone
|
||||||
// (matches AutoCAD; "Make current" is a separate action).
|
// ("Make current" is a separate action).
|
||||||
self.push_undo_snapshot(i, "CHPROP");
|
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) {
|
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||||
crate::scene::view::dispatch::apply_common_prop(entity, "layer", &layer);
|
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.tabs[i].dirty = true;
|
||||||
self.ribbon.active_layer = layer;
|
self.ribbon.active_layer = layer;
|
||||||
self.refresh_properties();
|
self.refresh_properties();
|
||||||
|
|
@ -1041,11 +1045,15 @@ pub(super) fn on_tab_close(&mut self, idx: usize) -> Task<Message> {
|
||||||
self.ribbon.active_linetype = lt;
|
self.ribbon.active_linetype = lt;
|
||||||
} else {
|
} else {
|
||||||
self.push_undo_snapshot(i, "CHPROP");
|
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) {
|
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||||
crate::scene::view::dispatch::apply_common_prop(entity, "linetype", <);
|
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.tabs[i].dirty = true;
|
||||||
self.ribbon.active_linetype = lt;
|
self.ribbon.active_linetype = lt;
|
||||||
self.refresh_properties();
|
self.refresh_properties();
|
||||||
|
|
|
||||||
|
|
@ -1971,11 +1971,15 @@ impl OpenCADStudio {
|
||||||
self.ribbon.active_lineweight = lw;
|
self.ribbon.active_lineweight = lw;
|
||||||
} else {
|
} else {
|
||||||
self.push_undo_snapshot(i, "CHPROP");
|
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) {
|
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||||
crate::scene::view::dispatch::apply_line_weight(entity, lw);
|
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.tabs[i].dirty = true;
|
||||||
self.ribbon.active_lineweight = lw;
|
self.ribbon.active_lineweight = lw;
|
||||||
self.refresh_properties();
|
self.refresh_properties();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue