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
+25 -5
+25 -5
View File
@@ -1687,16 +1687,36 @@ impl OpenCADStudio {
snapped, snapped,
); );
if let Some(value) = value { if let Some(value) = value {
if let Some(current) = let origin_value =
self.tabs[i].scene.document.get_entity_mut(grip.handle) crate::scene::view::dispatch::grip_menu_point_value(
{ &original,
*current = original; grip.grip_id,
action,
grip.origin_world,
);
let mut candidate = original.clone();
crate::entities::traits::EntityTypeOps::apply_grip_menu_value( crate::entities::traits::EntityTypeOps::apply_grip_menu_value(
current, &mut candidate,
grip.grip_id, grip.grip_id,
action, action,
value, 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) =
self.tabs[i].scene.document.get_entity_mut(grip.handle)
{
// Some radius/parallel positions have no geometric
// solution. Their entity edit is deliberately a
// no-op; retain the last valid preview instead of
// flashing back to the drag-start geometry. The
// exact origin remains reachable when the cursor
// moves back there.
if candidate != original || returns_to_origin {
*current = candidate;
}
} }
} }
} }