forked from 1b-agent/opencadstudio-upstream
feat(hatch): add and remove boundary vertices from the grip menu
A non-associative hatch's boundary vertex grips now offer Add Vertex and Remove Vertex next to Stretch, on polyline boundaries and on boundaries made of line edges alike. Add Vertex inserts the vertex after the picked one, halfway along the next segment (on the arc for a bulged polyline segment, splitting its bulge), and lets it be placed like any grip. Remove Vertex drops it while keeping at least a triangle. Line-edge boundaries used to show two grips at every corner (one line's end, the next one's start), so dragging one opened the loop; each corner is now one grip that moves both ends. The automation grip_menu_pick action chooses an entry of the open grip menu, so these edits can be scripted and checked. Fixes #1058 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4518569b61
commit
6490a625f2
4 files changed
+368
-134
No files matched your search
@@ -124,6 +124,7 @@ pub(super) const NAMES: &[&str] = &[
|
||||
"toggle_grid",
|
||||
"toggle_snap",
|
||||
"toggle_ortho",
|
||||
"grip_menu_pick",
|
||||
"mtext_insert",
|
||||
"mtext_commit",
|
||||
"mtext_cancel",
|
||||
@@ -1996,6 +1997,20 @@ impl OpenCADStudio {
|
||||
"toggle_grid" => Message::ToggleGrid,
|
||||
"toggle_snap" => Message::ToggleSnapEnabled,
|
||||
"toggle_ortho" => Message::ToggleOrtho,
|
||||
// Choose an entry of the open multi-functional grip menu by its
|
||||
// position (0 = first), as a click on it does.
|
||||
"grip_menu_pick" => {
|
||||
let entries = self.grip_popup.as_ref().map_or(0, |popup| popup.items.len());
|
||||
if entries == 0 {
|
||||
return Err(failure("menu_closed", "No grip menu is open"));
|
||||
}
|
||||
let index = string(req, "value")?
|
||||
.parse::<usize>()
|
||||
.ok()
|
||||
.filter(|index| *index < entries)
|
||||
.ok_or_else(|| failure("invalid_value", "value is a menu entry index"))?;
|
||||
Message::GripMenuPick(index)
|
||||
}
|
||||
"mtext_insert" => {
|
||||
if self.mtext_editor.is_none() {
|
||||
return Err(failure("editor_closed", "MText editor is closed"));
|
||||
|
||||
Reference in new issue
Block a user