feat(ucs): per-viewport UCS applied inside floating viewports

Extend UCS support to in-viewport (MSPACE) editing through the existing
single-converter structure: one active_ucs drives every UCS-aware system,
now in the Model tab AND inside a floating viewport.

- Single predicate DocumentTab::editing_model_space() (Model tab or active
  viewport) replaces the model-only gate in ucs_wire_affine,
  ucs_rotation_angle, ucs_grid_basis, viewcube_ucs_mat, the coordinate
  readout and the cursor-plane pick.
- Per-viewport UCS: refresh_active_ucs() sets active_ucs to the pane's UCS
  on every transition (the entered viewport's own UCS from its
  ucs_origin/x_axis/y_axis/ucs_per_viewport fields, the header model UCS in
  the Model tab, none in plain paper); persist_active_ucs() writes changes
  back to the viewport entity or the header so they round-trip. Wired into
  EnterViewport/ExitViewport, layout switch, load and the UCS command.
- Visuals: grid_views now returns each pane's handle so every content
  viewport's grid aligns to its own UCS; the UCS icon draws inside the
  active viewport projected through the viewport camera.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-24 17:23:29 +03:00
commit 295d3b1b5d
5 changed files with 164 additions and 33 deletions

View file

@ -3834,8 +3834,11 @@ impl OpenCADStudio {
}
}
}
// Keep the scene's ViewCube UCS in lock-step with active_ucs.
// Keep the scene's ViewCube UCS in lock-step with active_ucs and
// persist it to the active pane (per-viewport UCS inside a
// viewport, header model UCS in the Model tab) so it round-trips.
self.tabs[i].sync_ucs_to_scene();
self.tabs[i].persist_active_ucs();
}
// ── Named Views (VIEW command) ────────────────────────────────