forked from 1b-agent/opencadstudio-upstream
Merge pull request #1667 from ramox81/codex/view-presets
-VIEW command-line form: presets with orthographic UCS, sEttings and Window # Conflicts: # src/app/commands/mod.rs # src/io/mod.rs
This commit is contained in:
commit
e5df2fd113
13 files changed
+1101
-42
No files matched your search
@@ -794,6 +794,8 @@ impl OpenCADStudio {
|
||||
attdef_on_screen: crate::modules::draw::draw::attdef::session().on_screen,
|
||||
field_display: crate::entities::field::display(),
|
||||
surface_associativity: crate::scene::model::sweep_model::surface_associativity(),
|
||||
ucs_ortho: crate::modules::view::view_cmd::ucs_ortho(),
|
||||
ucs_view: crate::modules::view::view_cmd::ucs_view(),
|
||||
ncopy_bind: self.ncopy_bind,
|
||||
cursor_type: self.cursor_type,
|
||||
crosshair_color: self.crosshair_color,
|
||||
@@ -907,6 +909,8 @@ impl OpenCADStudio {
|
||||
crate::modules::draw::draw::attdef::session().on_screen = s.attdef_on_screen;
|
||||
crate::entities::field::set_display(s.field_display);
|
||||
crate::scene::model::sweep_model::set_surface_associativity(s.surface_associativity);
|
||||
crate::modules::view::view_cmd::set_ucs_ortho(s.ucs_ortho);
|
||||
crate::modules::view::view_cmd::set_ucs_view(s.ucs_view);
|
||||
self.ncopy_bind = s.ncopy_bind;
|
||||
self.cursor_type = s.cursor_type;
|
||||
self.crosshair_color = s.crosshair_color;
|
||||
|
||||
@@ -5976,15 +5976,25 @@ properties={:.1}ms picked={}",
|
||||
}
|
||||
|
||||
fn snap_view_region(&mut self, region: CubeRegion, r_ucs: glam::Mat4) -> Task<Message> {
|
||||
self.snap_view_region_as(region, r_ucs, true)
|
||||
}
|
||||
|
||||
/// A standard view preset (-VIEW): the world view itself, kept when it
|
||||
/// is shown already, with no cube message.
|
||||
pub(in crate::app) fn snap_view_preset(&mut self, region: CubeRegion) -> Task<Message> {
|
||||
self.snap_view_region_as(region, glam::Mat4::IDENTITY, false)
|
||||
}
|
||||
|
||||
fn snap_view_region_as(&mut self, region: CubeRegion, r_ucs: glam::Mat4, cube: bool) -> Task<Message> {
|
||||
let i = self.active_tab;
|
||||
self.clear_navigation_hover(i);
|
||||
self.tabs[i].scene.remember_current_view();
|
||||
let mut region = region;
|
||||
// "Already there → flip to opposite" check: compare the
|
||||
// current gaze direction with the region's target gaze.
|
||||
// "Already there → flip to opposite" check for a cube click: compare
|
||||
// the current gaze direction with the region's target gaze.
|
||||
let target_dir = r_ucs.transform_vector3(region.snap_direction());
|
||||
let cur_dir = self.tabs[i].scene.active_gaze_dir();
|
||||
if cur_dir.dot(target_dir) > 0.9999 {
|
||||
if cube && cur_dir.dot(target_dir) > 0.9999 {
|
||||
region = region.opposite();
|
||||
}
|
||||
let eye_dir = r_ucs.transform_vector3(region.snap_direction());
|
||||
@@ -6014,8 +6024,10 @@ properties={:.1}ms picked={}",
|
||||
}
|
||||
}
|
||||
self.tabs[i].scene.camera_generation += 1;
|
||||
self.command_line
|
||||
.push_output(crate::tf!("View: {}", crate::t!(region.label())).as_ref());
|
||||
if cube {
|
||||
self.command_line
|
||||
.push_output(crate::tf!("View: {}", crate::t!(region.label())).as_ref());
|
||||
}
|
||||
Task::none()
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user