forked from 1b-agent/opencadstudio-upstream
fix(viewcube): hover/click hit-test must match the drawn cube under UCS
The hover hit-tests used the bare camera rotation (no UCS) and the main camera even inside a floating viewport, so the highlighted face diverged from the cursor whenever a UCS was active or in a paper viewport — while the snap path was correct. Route hover, click-consume and snap through active_view_rotation_mat(), and compose the ViewCube UCS in its viewport branch so all three match ViewportData's drawn cam_rotation exactly. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
2507a8fe55
commit
3a4d842a7b
2 files changed
+36
-18
No files matched your search
+5
-1
@@ -3906,9 +3906,13 @@ impl Scene {
|
||||
/// paper-space camera's matrix when not in MSPACE.
|
||||
/// Used by ViewCube hit-testing so clicks map to the correct camera.
|
||||
pub fn active_view_rotation_mat(&self) -> glam::Mat4 {
|
||||
// Must match exactly what the drawn cube uses (see ViewportData's
|
||||
// `cam_rotation`): the active context's camera composed with the
|
||||
// ViewCube UCS. Inside a floating viewport that's the viewport's own
|
||||
// camera; the UCS factor applies in both cases.
|
||||
if let Some(h) = self.active_viewport {
|
||||
if let Some(cam) = self.camera_for_viewport(h) {
|
||||
return cam.view_rotation_mat();
|
||||
return cam.view_rotation_mat() * self.viewcube_ucs_mat();
|
||||
}
|
||||
}
|
||||
self.camera.borrow().view_rotation_mat() * self.viewcube_ucs_mat()
|
||||
|
||||
Reference in new issue
Block a user