forked from 1b-agent/opencadstudio-upstream
feat(view): DVIEW twists the view about its line of sight
DVIEW (alias DV) offers TWist and Undo. TWist rolls the active view or viewport camera to the typed angle; Undo steps back through the twists made in the session. The new alias reaches existing profiles through the alias migration table. Refs #638 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6490a625f2
commit
4ffae00199
31 files changed
+203
-1
No files matched your search
@@ -882,6 +882,9 @@ impl OpenCADStudio {
|
||||
CmdResult::ZoomToWindow { p1, p2 } => {
|
||||
self.handle_zoom_to_window(p1, p2);
|
||||
}
|
||||
CmdResult::TwistView(twist) => {
|
||||
self.handle_twist_view(twist);
|
||||
}
|
||||
CmdResult::Measurement(msg) => {
|
||||
self.handle_measurement(msg);
|
||||
}
|
||||
|
||||
@@ -447,6 +447,26 @@ impl OpenCADStudio {
|
||||
.push_output(crate::t!("Zoom Window").as_ref());
|
||||
}
|
||||
|
||||
/// Turn the active view about its line of sight so the drawing shows
|
||||
/// `twist` radians counter-clockwise from its untwisted orientation.
|
||||
pub(in crate::app) fn handle_twist_view(&mut self, twist: f64) {
|
||||
let i = self.active_tab;
|
||||
self.tabs[i].scene.remember_current_view();
|
||||
let set = |camera: &mut crate::scene::view::camera::Camera| {
|
||||
// The drawing turns one way when the camera rolls the other.
|
||||
camera.roll_by(-twist as f32 - camera.roll());
|
||||
};
|
||||
if self.tabs[i].scene.active_viewport.is_some() {
|
||||
self.tabs[i].scene.mutate_active_viewport_camera(set);
|
||||
} else {
|
||||
set(&mut self.tabs[i].scene.camera.borrow_mut());
|
||||
}
|
||||
self.tabs[i].scene.camera_generation += 1;
|
||||
if let Some(prompt) = self.tabs[i].active_cmd.as_ref().map(|c| c.prompt()) {
|
||||
self.command_line.push_info(&prompt);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn handle_set_plot_window(&mut self, p1: glam::DVec3, p2: glam::DVec3) {
|
||||
let i = self.active_tab;
|
||||
let layout_name = self.tabs[i].scene.current_layout.clone();
|
||||
|
||||
Reference in new issue
Block a user