Mouse gestures: ring of tools on the right button, per studio and customizable (#2934) (#2936)

* Mouse gestures: a ring of tools on the right button, per studio and customizable

Preferences > Navigation gets a Mouse gestures switch and a Customize window (number of
tools and their place, per studio). Gestures need the SolidWorks mouse mode and turn the
right-drag orbit off. The ring is 280/350 pt, one zone per tool, alternating tints (three
when the count is odd). The radial context menu is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dwcq9eNUMZ1jNeKvWd1bcZ

* Mouse gestures: the ring opens on the right-button press; the right-click menus are off while gestures are on

The ring opens at once on the press, even while a tool or dialog is active. While gestures are
active the viewport's right-click context menu, the right-click that finishes a tool and the
radial context menu no longer fire. With gestures off nothing changes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dwcq9eNUMZ1jNeKvWd1bcZ

* Mouse gestures: the ring opens after 4 px with the right button held; a plain right-click keeps its menu

The ring no longer opens on the press. It opens where the button went down once
the pointer has moved 4 points with the button held, even while a tool is in
progress. A right-click that does not move opens the usual context menu (or
finishes the tool) again; the release that ends a gesture opens no menu. The
radial menu stays off while gestures are active.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dwcq9eNUMZ1jNeKvWd1bcZ

* Re-trigger CI (the run was cancelled when approved-for-ci was added)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dwcq9eNUMZ1jNeKvWd1bcZ

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
GeorgetteandClaude Sonnet 5.5 authored and GitHub committed 2026-10-20 12:28:11 +00:00
1 parent 47108fa063
commit 876d57a67b
6 files changed
+1231 -5

No files matched your search

+4 -4
View File
@@ -129,7 +129,7 @@ impl Item {
pub fn on_if(self, enabled: bool) -> Item {
self.on(enabled)
}
fn on(mut self, enabled: bool) -> Item {
pub(crate) fn on(mut self, enabled: bool) -> Item {
self.enabled &= enabled;
self
}
@@ -140,7 +140,7 @@ impl Item {
}
/// A command entry: label, icon, shortcut and enablement come from the registry.
fn cmd(app: &SolveApp, id: &str, label: &str) -> Item {
pub(crate) fn cmd(app: &SolveApp, id: &str, label: &str) -> Item {
let info = solidcraft_engine::find_command(id).map(|c| c.info(&app.session));
let shortcut = match id {
"edit.undo" => "Ctrl+Z".to_string(),
@@ -158,7 +158,7 @@ fn cmd(app: &SolveApp, id: &str, label: &str) -> Item {
}
/// A view action (`ui.*`).
fn act(id: &str, label: &str, icon: &str) -> Item {
pub(crate) fn act(id: &str, label: &str, icon: &str) -> Item {
Item { id: id.into(), label: label.into(), shortcut: String::new(), enabled: true, icon: icon.into(), params: None }
}
@@ -1604,7 +1604,7 @@ fn slot_rect(c: Pos2, k: usize, size: Vec2) -> Rect {
/// Press-and-hold of the right button in the viewport opens the menu; releasing over a
/// direction picks it.
fn track_hold(app: &mut SolveApp, ctx: &egui::Context) {
if !app.preferences.radial_context_menu {
if !app.preferences.radial_context_menu || crate::mouse_gesture::active(app) {
app.menu.press = None;
app.menu.flick = false;
app.menu.radial = false;
+6
View File
@@ -77,6 +77,7 @@ mod loft_rails_dialog_tests;
#[cfg(test)]
mod look_at_tests;
mod material_card_review;
#[cfg(test)]
mod measurement_ui_tests;
#[cfg(test)]
@@ -130,6 +131,7 @@ pub(crate) mod display_lod;
mod file_load_ui_tests;
#[cfg(test)]
mod fillet_spline_handle_tests;
pub mod mouse_gesture;
pub(crate) mod navigation;
pub(crate) mod open_meshing;
pub mod palette;
@@ -339,6 +341,8 @@ pub struct SolveApp {
pub palette: palette::Palette,
/// Context menus, rename box and Properties window.
pub menu: context_menu::MenuState,
/// Mouse gestures: the ring of tools and its customization window.
pub gesture: mouse_gesture::State,
/// Browser tree state (reveal, groups being edited, occurrence moves).
pub tree: browser::TreeState,
/// A saved design copied for insertion into another open document.
@@ -486,6 +490,7 @@ impl SolveApp {
material_card_review: None,
palette: palette::Palette::default(),
menu: context_menu::MenuState::default(),
gesture: mouse_gesture::State::default(),
tree: browser::TreeState::default(),
linked_design_clipboard: None,
sbox: shortcut_box::ShortcutBox::default(),
@@ -1514,6 +1519,7 @@ impl SolveApp {
stand_up::show(self, ui.ctx());
prefs::show_reset_notice(self, ui.ctx());
context_menu::show(self, ui.ctx());
mouse_gesture::show(self, ui.ctx());
delete::show(self, ui.ctx());
shortcut_box::show(self, ui.ctx());
prefs::show(self, ui.ctx());
File diff suppressed because it is too large. Load diff
+9
View File
@@ -268,6 +268,8 @@ pub struct Prefs {
pub navigator_style: NavigatorStyle,
/// Show the radial ring and enable hold/flick gestures for viewport context menus.
pub radial_context_menu: bool,
/// Mouse gestures: a ring of tools on the right button (SolidWorks mouse mode only).
pub mouse_gestures: crate::mouse_gesture::Config,
/// The wheel zooms out when turned forward.
pub zoom_reverse: bool,
/// What an orbit turns around.
@@ -446,6 +448,7 @@ impl Default for Prefs {
nav: "fusion".into(),
navigator_style: NavigatorStyle::default(),
radial_context_menu: false,
mouse_gestures: Default::default(),
zoom_reverse: false,
orbit_around: OrbitAround::default(),
orbit_cursor: false,
@@ -762,6 +765,7 @@ fn defaults(app: &mut SolveApp, page: usize) {
p.nav = d.nav;
p.navigator_style = d.navigator_style;
p.radial_context_menu = d.radial_context_menu;
p.mouse_gestures = d.mouse_gestures;
p.zoom_reverse = d.zoom_reverse;
p.zoom_to_cursor = d.zoom_to_cursor;
p.smooth_wheel_zoom = d.smooth_wheel_zoom;
@@ -885,6 +889,10 @@ pub fn set_autosave(app: &mut SolveApp) {
/// Which navigation dragging `button` with `mods` held does under the preset.
pub fn nav_mode(app: &SolveApp, button: NavButton, mods: Modifiers) -> Option<NavMode> {
// With mouse gestures on, the right button opens the ring of tools instead of orbiting.
if button == NavButton::Right && crate::mouse_gesture::active(app) {
return None;
}
nav_preset(&app.preferences.nav).mode(button, mods)
}
@@ -1326,6 +1334,7 @@ fn page(app: &mut SolveApp, ui: &mut egui::Ui, t: &Tokens) {
ui.label(crate::i18n::tr_label("Context menu"));
ui.checkbox(&mut app.preferences.radial_context_menu, crate::i18n::tr_label("Radial context menu"));
ui.end_row();
crate::mouse_gesture::nav_rows(app, ui, t);
ui.label(crate::i18n::tr_label("View navigator"));
let picker =
egui::ComboBox::from_id_salt("pref_navigator_style").selected_text(crate::i18n::tr_label(app.preferences.navigator_style.label())).show_ui(ui, |ui| {
+2 -1
View File
@@ -2654,7 +2654,8 @@ pub fn show(app: &mut SolveApp, ui: &mut egui::Ui) {
.collect();
let _ = app.run("select.set", json!({ "items": items, "add": add }));
}
if resp.secondary_clicked() && delta == egui::Vec2::ZERO {
// A right-click, unless the same press opened the mouse gestures' ring.
if resp.secondary_clicked() && delta == egui::Vec2::ZERO && !crate::mouse_gesture::took_press(app) {
if app.tool.is_some() {
crate::tools::finish(app);
} else if app.dialog.is_none() {
+9
View File
@@ -32,6 +32,15 @@
in the default and Inventor presets. In every preset, Ctrl+left drag (Cmd on macOS) that starts
on empty space orbits; a Ctrl+click still adds to the selection. Shift+right-drag snaps to the nearest standard or
diagonal view; Shift does not request snapping when the preset already requires it to orbit.
**Mouse gestures** (Preferences › Navigation, off by default) work with the SolidWorks mouse preset
only (the wheel orbits, Ctrl + wheel pans) and take over the right button, which then no longer
orbits: hold it and move the pointer 4 pt to open a ring of tools (280 pt inside, 350 pt outside), even
while a tool is active, and touch a tool's zone to take it. A right-click that does not move still
opens the usual context menu. Each studio has its own
tools, and **Customize…** sets how many tools a studio's ring holds and in which place. Zones
alternate between two tints, three when the number of tools is odd. The optional radial context
menu is a separate setting, and gestures take the right button from it while they are on.
With **Touchpad** selected in Preferences › Navigation, hold **Shift** and move the pointer to
pan, or hold **Alt** (**Option** on macOS) and move it to orbit—no mouse button is needed.
Vertical two-finger scrolling zooms in this preset, regardless of the saved two-finger pan