Phase 4: Viewport control and properties

- Viewport ID uniqueness: commit_entity assigns max_existing_id+1
  instead of always using id=2
- Lock/On boolean toggles in Properties panel (vp_locked, vp_on)
  backed by status.locked / status.is_on fields
- Standard scale Choice picker: 1:500 to 10:1 (also syncs view_height)
- Numeric scale edit now syncs view_height when changed
- Standard view Choice picker: Top/Bottom/Front/Back/Left/Right/4×Iso
  updates view_direction vector via apply_geom_prop
- Viewport content not rendered when status.is_on is false
- current_layout_block_handle_pub() added for external access

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-03-31 07:27:03 +03:00
1 parent 523ba74c10
commit 031d2311ed
3 files changed
+174 -7

No files matched your search

+20 -1
View File
@@ -195,6 +195,25 @@ impl H7CAD {
if matches!(&entity, acadrust::EntityType::Viewport(_))
&& self.tabs[i].scene.current_layout != "Model"
{
// Assign a unique viewport ID (max existing id + 1, min 2).
if let acadrust::EntityType::Viewport(ref mut vp) = entity {
let layout_block = self.tabs[i].scene.current_layout_block_handle_pub();
let max_id = self.tabs[i]
.scene
.document
.entities()
.filter_map(|e| {
if let acadrust::EntityType::Viewport(v) = e {
if v.common.owner_handle == layout_block { Some(v.id) } else { None }
} else {
None
}
})
.max()
.unwrap_or(1);
vp.id = (max_id + 1).max(2);
}
let layout = self.tabs[i].scene.current_layout.clone();
match self.tabs[i]
.scene
@@ -204,7 +223,7 @@ impl H7CAD {
Ok(_) => {}
Err(e) => self
.command_line
.push_error(&format!("Viewport eklenemedi: {e}")),
.push_error(&format!("Viewport could not be added: {e}")),
}
} else {
self.tabs[i].scene.add_entity(entity);