forked from 1b-agent/opencadstudio-upstream
Merge pull request #1251
This commit is contained in:
commit
2d20bdd51c
8 files changed
+864
-42
No files matched your search
@@ -1619,6 +1619,9 @@ impl OpenCADStudio {
|
||||
GripEditMode::RectangleHeight => {
|
||||
Some(crate::scene::model::object::GripMenuAction::RectangleHeight)
|
||||
}
|
||||
GripEditMode::MoveParallel => {
|
||||
Some(crate::scene::model::object::GripMenuAction::MoveParallel)
|
||||
}
|
||||
GripEditMode::RectangleResize => None,
|
||||
GripEditMode::Stretch => None,
|
||||
};
|
||||
@@ -1682,16 +1685,36 @@ impl OpenCADStudio {
|
||||
snapped,
|
||||
);
|
||||
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) =
|
||||
self.tabs[i].scene.document.get_entity_mut(grip.handle)
|
||||
{
|
||||
*current = original;
|
||||
crate::entities::traits::EntityTypeOps::apply_grip_menu_value(
|
||||
current,
|
||||
grip.grip_id,
|
||||
action,
|
||||
value,
|
||||
);
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3360,6 +3383,7 @@ impl OpenCADStudio {
|
||||
grip.mode,
|
||||
GripEditMode::Lengthen | GripEditMode::Radius | GripEditMode::ArcLength
|
||||
| GripEditMode::RectangleWidth | GripEditMode::RectangleHeight
|
||||
| GripEditMode::MoveParallel
|
||||
) {
|
||||
self.grip_pending = None;
|
||||
self.command_line.input.clear();
|
||||
|
||||
Reference in new issue
Block a user