feat(paper): native sheet viewport for paper-space camera

Persist the paper-space camera through the sheet viewport entity (which
round-trips natively in both DXF and DWG) instead of the
OpenCADStudio_Camera_* named-View side-channel:

- apply_sheet_viewport_camera reads the sheet viewport entity first; the
  named View is only a backward-compat fallback for older files.
- sync_camera_to_document (paper) writes the camera only to the sheet
  viewport entity. Model branch is unchanged.
- Add Scene::ensure_sheet_viewport: guarantee every paper layout has its
  full-screen overall (id==1) viewport, creating one if a loaded file
  lacks it; wired into layout enter and add_layout.
- Restore the owner-handle guard on the sheet-viewport finder so a
  foreign layout's viewport can't be picked as the sheet viewport.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-02 19:38:42 +03:00
1 parent f147e384d0
commit 568422679d
2 files changed
+124 -39

No files matched your search

+3
View File
@@ -4254,6 +4254,9 @@ impl OpenCADStudio {
}
}
self.tabs[i].scene.current_layout = new_name.clone();
// Safety net — `add_layout` already creates the overall
// sheet viewport; this covers any path that doesn't.
self.tabs[i].scene.ensure_sheet_viewport(&new_name);
self.tabs[i].scene.deselect_all();
self.tabs[i].scene.fit_all();
if let Some(idx) = self.ribbon.layout_module_index() {