forked from 1b-agent/opencadstudio-upstream
fix(parametric): constraint point picks snap to endpoints and midpoints again
Entity picks switch object snap off, but COINCIDENT (and the other constraints that take a point) only recognise a point when the pick lands exactly on it. Without snap there were no point markers and every pick became the whole curve. Point-accepting entity picks now keep object snap and hand the snapped point to the command. Discussion #1526 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f8db262577
commit
0a3dab12e3
1 file changed
+20
-9
@@ -2124,7 +2124,18 @@ impl OpenCADStudio {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|c| c.needs_tangent_pick())
|
.map(|c| c.needs_tangent_pick())
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
self.tabs[i].snap_result = if needs_entity || is_gathering || needs_structure {
|
// An entity pick that also takes points (constraint point picks)
|
||||||
|
// keeps object snap: the point is only recognised when the pick
|
||||||
|
// lands exactly on it, and the markers show where that is. (#1526)
|
||||||
|
let entity_pick_takes_points = needs_entity
|
||||||
|
&& self.tabs[i]
|
||||||
|
.active_cmd
|
||||||
|
.as_ref()
|
||||||
|
.is_some_and(|command| command.entity_pick_accepts_points());
|
||||||
|
self.tabs[i].snap_result = if (needs_entity && !entity_pick_takes_points)
|
||||||
|
|| is_gathering
|
||||||
|
|| needs_structure
|
||||||
|
{
|
||||||
None
|
None
|
||||||
} else if needs_tan {
|
} else if needs_tan {
|
||||||
self.snapper.snap_tangent_only(
|
self.snapper.snap_tangent_only(
|
||||||
@@ -3786,7 +3797,12 @@ impl OpenCADStudio {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|c| c.needs_entity_pick())
|
.map(|c| c.needs_entity_pick())
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
let mut snap_hit = if needs_entity_click {
|
let entity_click_takes_points = needs_entity_click
|
||||||
|
&& self.tabs[i]
|
||||||
|
.active_cmd
|
||||||
|
.as_ref()
|
||||||
|
.is_some_and(|command| command.entity_pick_accepts_points());
|
||||||
|
let mut snap_hit = if needs_entity_click && !entity_click_takes_points {
|
||||||
None
|
None
|
||||||
} else if needs_tan {
|
} else if needs_tan {
|
||||||
self.snapper.snap_tangent_only(
|
self.snapper.snap_tangent_only(
|
||||||
@@ -4018,13 +4034,8 @@ impl OpenCADStudio {
|
|||||||
pt = r;
|
pt = r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if needs_entity_click
|
if entity_click_takes_points {
|
||||||
&& self.tabs[i]
|
snap_hit.map_or(raw, |hit| hit.world)
|
||||||
.active_cmd
|
|
||||||
.as_ref()
|
|
||||||
.is_some_and(|command| command.entity_pick_accepts_points())
|
|
||||||
{
|
|
||||||
raw
|
|
||||||
} else {
|
} else {
|
||||||
pt
|
pt
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user