fix(viewcube): snap a paper viewport square to the UCS, not WCS
Clicking the ViewCube inside a floating viewport set only view_direction, so the rebuilt camera fell back to WCS-up and the view opened tilted relative to the UCS-oriented cube the user clicked. Build the full UCS-aligned orientation (snap_to_direction with the ViewCube UCS) and decode it to the viewport's stored (view_direction, twist_angle). twist can't come from -Camera::roll(): camera_from_view rebuilds rotation with its own yaw convention (atan2(x,-y)) and roll = -twist, which differs from the camera's internal sync_yaw_pitch. Instead reproduce the decoder's zero-twist basis and store twist = -signed_angle(up0 -> desired_up). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
3a4d842a7b
commit
7f36cf512f
2 changed files with 33 additions and 6 deletions
|
|
@ -4433,7 +4433,7 @@ impl OpenCADStudio {
|
|||
if self.tabs[i].scene.active_viewport.is_some() {
|
||||
self.tabs[i]
|
||||
.scene
|
||||
.snap_active_viewport_to_direction(eye_dir);
|
||||
.snap_active_viewport_to_direction(eye_dir, r_ucs);
|
||||
} else {
|
||||
let mut cam = self.tabs[i].scene.camera.borrow_mut();
|
||||
cam.snap_to_direction(eye_dir, r_ucs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue