Preserve valid grip preview when edits have no geometric solution

This commit is contained in:
Marcel committed 2026-09-14 12:30:51 +02:00
1 parent 6f008faa9a
commit 9ae1e6dd76
1 file changed
+27 -7
+27 -7
View File
@@ -1687,16 +1687,36 @@ impl OpenCADStudio {
snapped, snapped,
); );
if let Some(value) = value { if let Some(value) = value {
let origin_value =
crate::scene::view::dispatch::grip_menu_point_value(
&original,
grip.grip_id,
action,
grip.origin_world,
);
let mut candidate = original.clone();
crate::entities::traits::EntityTypeOps::apply_grip_menu_value(
&mut candidate,
grip.grip_id,
action,
value,
);
let returns_to_origin = origin_value.is_some_and(|origin_value| {
(value - origin_value).abs()
<= 1.0e-9 * value.abs().max(origin_value.abs()).max(1.0)
});
if let Some(current) = if let Some(current) =
self.tabs[i].scene.document.get_entity_mut(grip.handle) self.tabs[i].scene.document.get_entity_mut(grip.handle)
{ {
*current = original; // Some radius/parallel positions have no geometric
crate::entities::traits::EntityTypeOps::apply_grip_menu_value( // solution. Their entity edit is deliberately a
current, // no-op; retain the last valid preview instead of
grip.grip_id, // flashing back to the drag-start geometry. The
action, // exact origin remains reachable when the cursor
value, // moves back there.
); if candidate != original || returns_to_origin {
*current = candidate;
}
} }
} }
} }