forked from 1b-agent/opencadstudio-upstream
fix(select): pick 3D solids by clicking their body, not just edges
Single-click selection only tested wire-edge proximity, so clicking a solid's face missed — only its thin projected edges were selectable. Add mesh_click_hit: project each mesh triangle to screen and test the cursor against it (front-most wins), wired as a fallback after the wire and hatch hit-tests. Works for any meshed solid. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
7bf9ce31ae
commit
47a4bf19b3
3 files changed
+65
No files matched your search
@@ -1593,6 +1593,21 @@ impl Scene {
|
||||
}
|
||||
}
|
||||
|
||||
/// Pick a meshed 3D solid by clicking on its shaded body (face), not just
|
||||
/// its thin projected edges. Returns the front-most mesh under `cursor`.
|
||||
pub fn mesh_click_hit(
|
||||
&self,
|
||||
cursor: iced::Point,
|
||||
view_proj: glam::Mat4,
|
||||
bounds: iced::Rectangle,
|
||||
) -> Option<Handle> {
|
||||
let iter = self
|
||||
.meshes
|
||||
.iter()
|
||||
.filter_map(|(h, set)| set.lods.first().map(|m| (*h, m)));
|
||||
hit_test::mesh_click_hit(cursor, iter, view_proj, bounds)
|
||||
}
|
||||
|
||||
/// Tessellate all non-invisible entities owned by `block_handle`.
|
||||
fn wires_for_block(&self, block_handle: Handle) -> Vec<WireModel> {
|
||||
// Default culling is driven by the live `Scene::camera`. Multi-tile
|
||||
|
||||
Reference in new issue
Block a user