feat(viewport): RMB 1st=Enter, 2nd=menu (no setting)

Replaces the opt-in `rmb_enter` setting (and `RMBENTER` command) with
always-on behavior. While a command is active, the first viewport
right-click acts as Enter (commit / close) and a second consecutive
right-click opens the context menu instead. Idle right-click still opens
the menu; right-drag still orbits.

The cycle is tracked per tab (`right_click_entered`) and restarts on any
other interaction — a left-click pick, a new command, an orbit, or
leaving the viewport — so the next right-click is Enter again.

Refines #185.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-06-27 16:32:40 +03:00
1 parent 098585bb2d
commit b691854e7a
8 files changed
+26 -41

No files matched your search

-21
View File
@@ -17,27 +17,6 @@ impl OpenCADStudio {
.push_output("PAN: drag with the left mouse button. Press Esc to exit.");
}
// RMBENTER [ON|OFF] — toggle whether a viewport right-click acts as
// Enter (commit / close) while a command is active. Idle right-click
// still opens the context menu and right-drag still orbits. The
// preference is persisted across runs.
cmd if cmd == "RMBENTER" || cmd.starts_with("RMBENTER ") => {
let arg = cmd
.split_once(' ')
.map(|(_, r)| r.trim().to_uppercase())
.unwrap_or_default();
self.rmb_enter = match arg.as_str() {
"ON" | "1" => true,
"OFF" | "0" => false,
_ => !self.rmb_enter,
};
self.command_line.push_output(if self.rmb_enter {
"RMBENTER on: right-click acts as Enter while a command is active."
} else {
"RMBENTER off: right-click opens the context menu."
});
}
// ── TABLE cell editing ─────────────────────────────────────────────
// TABLE CELL <row> <col> <text> — set text for a cell in the selected Table
cmd if cmd.starts_with("TABLE ") => {
+4 -1
View File
@@ -67,6 +67,9 @@ impl OpenCADStudio {
// Reset the last committed point so the first click of the new command
// is not constrained by ortho/polar relative to a previous command's endpoint.
self.last_point = None;
// Starting a command restarts the right-click cycle, so its first
// right-click acts as Enter rather than opening the context menu.
self.tabs[i].scene.selection.borrow_mut().right_click_entered = false;
// A fresh command starts at the polar/cartesian default — clear
// any `,`-driven reshape from a previous command (#35).
self.dyn_user_reshaped = false;
@@ -208,7 +211,7 @@ inventory::submit!(crate::command::CommandRegistration {
"P", "PAN", "PAGESETUP", "PERF", "PERSP", "PLOT", "PLOTSTYLE", "PLOTSTYLEEDITOR",
"PLOTSTYLEPANEL", "PR",
"PRINT", "PROPERTIES", "PROPS", "PSPACE", "PURGE", "QS", "QSAVE", "QSELECT",
"QUIT", "REDO", "REDRAW", "REDRWALL", "REGEN", "REGENALL", "RENAME", "REPORT", "RMBENTER",
"QUIT", "REDO", "REDRAW", "REDRWALL", "REGEN", "REGENALL", "RENAME", "REPORT",
"SA", "SAVE", "SAVEAS", "SCALETEXT", "SELECTALL", "SELECTSIMILAR", "SELSIM", "SHEETSET",
"SHORTCUTS", "SOLID", "SSM", "STEPOUT", "STLOUT", "STPOUT", "STYLE", "STYLESMANAGER",
"TABLESTYLE", "TOOLPALETTES", "TP", "TS", "U", "UCS", "UCSICON", "UNDERLAY",