feat(ucs): orient the ViewCube to the active UCS

The ViewCube showed world Front/Top/Right. It now composes the camera
rotation with the active UCS (scene.viewcube_ucs, synced from the tab's
active_ucs), so its faces follow the user's coordinate system in model
space. Render uniform, hover/click hit-test, and the click→snap direction
all go through scene.viewcube_ucs_mat() so they stay in lock-step;
identity outside model space leaves paper-viewport navigation unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-22 10:10:47 +03:00
commit d78ed60582
5 changed files with 43 additions and 9 deletions

View file

@ -186,6 +186,19 @@ impl DocumentTab {
} else {
Some(u)
};
self.sync_ucs_to_scene();
}
/// Push the active UCS rotation into the scene so the ViewCube composes with
/// it. Call after any change to `active_ucs`.
pub(super) fn sync_ucs_to_scene(&mut self) {
let (_, x, y, z) = self.ucs_xform().axes();
self.scene.viewcube_ucs = glam::Mat4::from_cols(
x.extend(0.0),
y.extend(0.0),
z.extend(0.0),
glam::Vec4::W,
);
}
pub(super) fn new_drawing(n: usize) -> Self {