forked from 1b-agent/opencadstudio-upstream
Feat: viewport UCS name picker from document UCS table
- properties.rs: inject 'UCS Name' Choice property for viewports when document.ucss is non-empty; resolves current handle to display name - update.rs: intercept PropGeomChoiceChanged for 'vp_ucs_name'; clones UCS origin/x_axis/y_axis into viewport and sets ucs_handle — no trait signature change required Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ad2f4a8cb
commit
36bda2ac2b
2 files changed
+49
-4
No files matched your search
+23
-3
@@ -1484,9 +1484,29 @@ impl H7CAD {
|
||||
let handles = self.property_target_handles(i);
|
||||
if !handles.is_empty() {
|
||||
self.push_undo_snapshot(i, "CHPROP");
|
||||
for handle in handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
crate::scene::dispatch::apply_geom_prop(entity, field, &value);
|
||||
if field == "vp_ucs_name" {
|
||||
// Resolve UCS name → cloned data, then mutate viewports.
|
||||
let ucs_data = self.tabs[i].scene.document.ucss
|
||||
.iter()
|
||||
.find(|u| u.name == value)
|
||||
.cloned();
|
||||
if let Some(ucs) = ucs_data {
|
||||
for handle in &handles {
|
||||
if let Some(acadrust::EntityType::Viewport(vp)) =
|
||||
self.tabs[i].scene.document.get_entity_mut(*handle)
|
||||
{
|
||||
vp.ucs_handle = ucs.handle;
|
||||
vp.ucs_origin = ucs.origin.clone();
|
||||
vp.ucs_x_axis = ucs.x_axis.clone();
|
||||
vp.ucs_y_axis = ucs.y_axis.clone();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for handle in handles {
|
||||
if let Some(entity) = self.tabs[i].scene.document.get_entity_mut(handle) {
|
||||
crate::scene::dispatch::apply_geom_prop(entity, field, &value);
|
||||
}
|
||||
}
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
|
||||
Reference in new issue
Block a user