forked from 1b-agent/opencadstudio-upstream
Merge pull request #1187 from ramox81/codex/complete-splinedit-options
This commit is contained in:
commit
67768a3eca
5 files changed
+436
-165
No files matched your search
@@ -312,6 +312,33 @@ impl OpenCADStudio {
|
||||
true
|
||||
}
|
||||
|
||||
/// Refresh screen-space feature picking immediately before point dispatch.
|
||||
pub(super) fn refresh_command_point_pick_context(&mut self, i: usize) {
|
||||
if self.tabs[i].active_cmd.as_ref()
|
||||
.is_some_and(|command| command.wants_point_pick_context())
|
||||
{
|
||||
let scene = &self.tabs[i].scene;
|
||||
let size = scene.selection.borrow().vp_size;
|
||||
let edit = scene.viewport_edit_frame(size);
|
||||
let tile = edit.as_ref().map(|(_, rect)| *rect)
|
||||
.unwrap_or_else(|| scene.active_model_tile_bounds(size.0, size.1));
|
||||
let bounds = iced::Rectangle { x: 0.0, y: 0.0, width: tile.width, height: tile.height };
|
||||
let context = if bounds.width > 0.0 && bounds.height > 0.0 {
|
||||
let (view, eye) = if let Some((camera, _)) = edit {
|
||||
(camera.view_proj_rte(bounds), camera.eye())
|
||||
} else {
|
||||
let camera = scene.camera.borrow();
|
||||
(camera.view_proj_rte(bounds), camera.eye())
|
||||
};
|
||||
Some(crate::command::PointPickContext { view, eye, bounds,
|
||||
aperture_px: crate::ui::overlay::pick_box_aperture_px(self.pick_box) })
|
||||
} else { None };
|
||||
if let Some(command) = self.tabs[i].active_cmd.as_mut() {
|
||||
command.set_point_pick_context(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Drive the active command's step machine with one [`StepInput`], then
|
||||
/// apply the result. This is the single entry point every input source
|
||||
/// (command line, headless, dynamic input, plugin API, viewport) funnels
|
||||
@@ -390,10 +417,13 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
if let StepInput::SelectionComplete(handles) = &input {
|
||||
let exclude_locked = self.tabs[i].active_cmd.as_ref()
|
||||
.is_some_and(|command| command.selection_entities_exclude_locked());
|
||||
let entities = {
|
||||
let scene = &self.tabs[i].scene;
|
||||
handles
|
||||
.iter()
|
||||
.filter(|handle| !exclude_locked || !scene.is_layer_locked(**handle))
|
||||
.filter_map(|handle| {
|
||||
scene.document.get_entity(*handle).cloned().map(|entity| {
|
||||
let surface_area = scene
|
||||
@@ -414,6 +444,7 @@ impl OpenCADStudio {
|
||||
command.inject_selection_entities(entities);
|
||||
}
|
||||
}
|
||||
if matches!(&input, StepInput::Point(_)) { self.refresh_command_point_pick_context(i); }
|
||||
let ctrl = self.ctrl_down;
|
||||
let shift = self.shift_down;
|
||||
let result: Option<CmdResult> = {
|
||||
|
||||
Reference in new issue
Block a user