feat: right-click context menu + CONSTRUCTIONLINE alias

Viewport right-click now shows a proper widget-based context menu:
- When a command is active: Cancel / Enter
- Otherwise: Repeat last commands, Delete/Move/Copy (if selected),
  Select All, Zoom Extents

CONSTRUCTIONLINE added as an alias for XLINE (XL).
Canvas-drawn placeholder removed; context menu closes on Escape,
click-outside, or when any action is taken.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-08 00:41:01 +03:00
1 parent a20558a024
commit 3cdd86a674
7 files changed
+145 -50

No files matched your search

+22 -2
View File
@@ -498,7 +498,15 @@ impl H7CAD {
}
Message::CommandEscape => {
// Cancel layout rename / context menu first, then fall through.
// Cancel layout rename / context menus first, then fall through.
let i_e = self.active_tab;
{
let mut sel = self.tabs[i_e].scene.selection.borrow_mut();
if sel.context_menu.is_some() {
sel.context_menu = None;
return Task::none();
}
}
if self.layout_rename_state.take().is_some() || self.layout_context_menu.take().is_some() {
return Task::none();
}
@@ -522,7 +530,12 @@ impl H7CAD {
Task::none()
}
Message::Command(cmd) => self.dispatch_command(&cmd),
Message::Command(cmd) => {
// Close viewport context menu if open.
let i = self.active_tab;
self.tabs[i].scene.selection.borrow_mut().context_menu = None;
self.dispatch_command(&cmd)
}
Message::ToggleLayers => {
if let Some(id) = self.layer_window.take() {
@@ -1708,6 +1721,7 @@ impl H7CAD {
Message::DeleteSelected => {
let i = self.active_tab;
self.tabs[i].scene.selection.borrow_mut().context_menu = None;
let handles: Vec<_> = self.tabs[i].scene.selected.iter().cloned().collect();
if !handles.is_empty() {
self.push_undo_snapshot(i, "ERASE");
@@ -2127,6 +2141,12 @@ impl H7CAD {
Task::none()
}
Message::ViewportContextMenuClose => {
let i = self.active_tab;
self.tabs[i].scene.selection.borrow_mut().context_menu = None;
Task::none()
}
Message::EnterViewport(handle) => {
let i = self.active_tab;
// Clear paper-space selection before entering model space.