Hidden origin planes and axes are not pickable: Create Sketch only brings the Origin back when no body is shown; origin and construction planes give way to a face or profile at the same depth (a shelled box's floor where the XZ plane crosses it). Scenarios hidden_origin_planes_not_pickable and face_wins_over_origin_plane
Fixes #31 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT
This commit is contained in:
1 parent
67c79ec91c
commit
ab574952b1
4 files changed
+183
-4
No files matched your search
@@ -547,8 +547,12 @@ impl SolveApp {
|
||||
}
|
||||
|
||||
/// Is the origin widget shown (always while picking a sketch plane)?
|
||||
/// Origin planes and axes are drawn and pickable. Hidden ones only come back while Create
|
||||
/// Sketch has nothing else to offer (no body shown).
|
||||
pub fn origin_visible(&self) -> bool {
|
||||
self.ui.show_origin || self.dialog.as_ref().is_some_and(|d| matches!(d.kind, dialogs::Kind::Sketch))
|
||||
self.ui.show_origin
|
||||
|| (self.dialog.as_ref().is_some_and(|d| matches!(d.kind, dialogs::Kind::Sketch))
|
||||
&& !self.session.world_state().bodies.iter().any(|b| !self.ui.hidden_bodies.contains(&b.name)))
|
||||
}
|
||||
|
||||
pub fn set_status(&mut self, s: impl Into<String>, error: bool) {
|
||||
|
||||
@@ -406,7 +406,9 @@ pub fn origin_planes(app: &SolveApp) -> Vec<(&'static str, Vec3, [Vec3; 4])> {
|
||||
if !app.origin_visible() {
|
||||
return Vec::new();
|
||||
}
|
||||
let creating = app.dialog.as_ref().is_some_and(|d| matches!(d.kind, crate::dialogs::Kind::Sketch));
|
||||
// While the Origin is hidden, Create Sketch may bring the planes back (empty design): then
|
||||
// every plane; otherwise only those not hidden one by one.
|
||||
let creating = !app.ui.show_origin && app.dialog.as_ref().is_some_and(|d| matches!(d.kind, crate::dialogs::Kind::Sketch));
|
||||
origin_quads(origin_size(app.cam.half_height()))
|
||||
.into_iter()
|
||||
.filter(|(n, _, _)| creating || !app.ui.hidden_origin.iter().any(|h| h == n))
|
||||
@@ -740,14 +742,15 @@ pub fn pick(app: &SolveApp, proj: &Proj, pos: Pos2) -> Vec<Hit> {
|
||||
if let Some(f) = bestf {
|
||||
surf.push(f);
|
||||
}
|
||||
// Planes give way to a face or profile at the same depth (a floor on the XZ plane).
|
||||
for (name, _, q) in origin_planes(app) {
|
||||
if let Some(t) = ray_quad(o, d, &q) {
|
||||
surf.push((t, Hit::Plane { name: name.into(), point: o + d * t }));
|
||||
surf.push((t + slack, Hit::Plane { name: name.into(), point: o + d * t }));
|
||||
}
|
||||
}
|
||||
for (name, _, q) in construction_quads(app) {
|
||||
if let Some(t) = ray_quad(o, d, &q) {
|
||||
surf.push((t, Hit::Plane { name, point: o + d * t }));
|
||||
surf.push((t + slack, Hit::Plane { name, point: o + d * t }));
|
||||
}
|
||||
}
|
||||
surf.sort_by(|a, b| a.0.total_cmp(&b.0));
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
[
|
||||
{
|
||||
"note": "#31: a face wins a tie with an origin plane through it (a shelled box's floor where the XZ plane crosses it)."
|
||||
},
|
||||
{
|
||||
"call": "engine.execute",
|
||||
"params": {
|
||||
"command": "solid.box",
|
||||
"params": {
|
||||
"corner": [
|
||||
-10,
|
||||
-10,
|
||||
0
|
||||
],
|
||||
"length": 20,
|
||||
"width": 20,
|
||||
"height": 6
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "engine.execute",
|
||||
"params": {
|
||||
"command": "solid.shell",
|
||||
"params": {
|
||||
"faces": [
|
||||
[
|
||||
0,
|
||||
0,
|
||||
6
|
||||
]
|
||||
],
|
||||
"thickness": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"volume": [
|
||||
1376,
|
||||
0.001
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "ui.view",
|
||||
"params": {
|
||||
"view": "iso"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "sketch.create"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"world": [
|
||||
0,
|
||||
0,
|
||||
2
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"sketching": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"query": {
|
||||
"command": "sketch.inspect",
|
||||
"path": [
|
||||
"plane",
|
||||
"origin",
|
||||
2
|
||||
],
|
||||
"value": 2
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,91 @@
|
||||
[
|
||||
{
|
||||
"note": "#31: with the Origin hidden, its planes are not pickable in Create Sketch (a body is shown, so they don't come back)."
|
||||
},
|
||||
{
|
||||
"call": "engine.execute",
|
||||
"params": {
|
||||
"command": "solid.box",
|
||||
"params": {
|
||||
"corner": [
|
||||
6,
|
||||
-15,
|
||||
0
|
||||
],
|
||||
"length": 4,
|
||||
"width": 4,
|
||||
"height": 4
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "engine.execute",
|
||||
"params": {
|
||||
"command": "solid.box",
|
||||
"params": {
|
||||
"corner": [
|
||||
-15,
|
||||
10,
|
||||
-5
|
||||
],
|
||||
"length": 3,
|
||||
"width": 3,
|
||||
"height": 3
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "ui.view",
|
||||
"params": {
|
||||
"view": "fit"
|
||||
}
|
||||
},
|
||||
{
|
||||
"call": "ui.view",
|
||||
"params": {
|
||||
"view": "iso"
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "sketch.create"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"plane": "YZ"
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"sketching": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "sketch.finish"
|
||||
},
|
||||
{
|
||||
"call": "ui.set",
|
||||
"params": {
|
||||
"showOrigin": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"start": "sketch.create"
|
||||
},
|
||||
{
|
||||
"click": {
|
||||
"world": [
|
||||
0,
|
||||
3,
|
||||
3
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"expect": {
|
||||
"sketching": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "Escape"
|
||||
}
|
||||
]
|
||||
Reference in new issue
Block a user