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 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-03-31 07:27:03 +03:00
commit 031d2311ed
3 changed files with 174 additions and 7 deletions

View file

@ -84,6 +84,13 @@ impl Scene {
}
}
/// Public accessor for the block-record handle of the current layout.
/// Used by external callers (e.g. `commit_entity`) that need the handle
/// without going through private API.
pub fn current_layout_block_handle_pub(&self) -> Handle {
self.current_layout_block_handle()
}
/// Returns the block-record handle for `current_layout`.
fn current_layout_block_handle(&self) -> Handle {
self.document
@ -382,7 +389,8 @@ impl Scene {
None
}
})
.filter(|vp| vp.id > 1 && vp.common.owner_handle == paper_block)
// Only user viewports (id > 1) that belong to this layout AND are turned on.
.filter(|vp| vp.id > 1 && vp.common.owner_handle == paper_block && vp.status.is_on)
.collect();
if viewports.is_empty() {