feat(viewport): RMB=Enter option + timed right-click

Adds a configurable right-mouse-button behavior without disturbing orbit
or the context menu.

- New persisted setting `rmb_enter` (command `RMBENTER [ON|OFF]`, default
  off): when on, a right-click while a command is active acts as Enter
  (commit/close); when idle it still opens the context menu. Right-drag
  always orbits, so nothing is lost.
- Right-click vs orbit is now time-based: orbit engages only after the
  button is held >=150ms and the pointer moves, so a quick right-click is
  no longer swallowed by slight pointer jitter (was an 8px distance gate).
- The right-click Repeat menu now lists commands from every source
  (command line, ribbon, context menu, shortcuts) via a unified
  recents list recorded at the dispatch choke point, instead of only
  typed commands.

Closes #185

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-06-27 16:16:08 +03:00
commit 098585bb2d
10 changed files with 157 additions and 53 deletions

View file

@ -17,6 +17,27 @@ 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 ") => {