Settings > Mouse: the mouse as in each major CAD program, by name (asked for: "It should have controls presets from all major CAD apps").

The four styles named by what they do are seven presets named for the programs that work that way, those alike sharing a row: superGeometry / Onshape / Tinkercad (right drag turns, middle moves); Fusion / Inventor / Revit / AutoCAD (Shift + middle turns, middle moves, Ctrl + Shift + middle zooms); SolidWorks (middle turns, Ctrl + middle moves, Shift + middle zooms); Creo / Solid Edge / Blender / SketchUp (middle turns, Shift + middle moves, Ctrl + middle zooms); NX (middle turns, middle + right moves, middle + left zooms, Shift and Ctrl as well); CATIA / FreeCAD (middle moves, middle with left or right held turns, Ctrl + middle zooms); Rhino (right turns, Shift + right moves, Ctrl + right zooms). Under the list, what the chosen one does in words.

Two buttons held together (NX, CATIA, FreeCAD) are new: while the middle button drags the view, another button pressed with it changes what the drag does, and let go it changes back. The wheel's way round stays its own switch (the programs differ, and each lets it be turned over). A plain right drag still turns the view in every preset, and Alt + left drag.

The presets are a table in settings.ts (MOUSE_PRESETS), one function for a press and one for buttons held together; a setting not known is the app's own way. tests/mousepresets.test.ts, 13 checks: every press of every preset. In the app: middle, then right and left held with it, in four presets; the list in Settings, a preset chosen and kept.

Fusion, SolidWorks, Creo, Onshape, Tinkercad, NX and CATIA are as their makers' pages give them (looked up 2026-11-24); Rhino, Solid Edge, SketchUp, Blender, Inventor, Revit, AutoCAD and FreeCAD from what is widely known of them, not checked against a page.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
superGeometry
2026-11-24 14:39:15 +02:00
parent 6f131b2efc
commit f9bfba7322
6 changed files with 161 additions and 47 deletions
+5 -4
View File
@@ -106,10 +106,11 @@ There's no wrong order. Undo (bottom left) is always one tap away.
| Deselect | Esc or click empty space | tap empty space | tap empty space |
| Step back | right-click or Esc | - | - |
- **Used to another program's mouse?** Settings → Mouse has four styles for
which drag turns and which moves the view (right drag turns; middle drag
turns with Shift to move; Shift + middle turns with middle to move; middle
turns with Ctrl to move), and which way the wheel zooms.
- **Used to another program's mouse?** Settings → Mouse makes the buttons
turn, move and zoom the view as they do there: Onshape and Tinkercad (the
way the app comes), Fusion / Inventor / Revit / AutoCAD, SolidWorks,
Creo / Solid Edge / Blender / SketchUp, NX, CATIA / FreeCAD, or Rhino -
and sets which way the wheel zooms.
- **Right-click steps back**: first what's half done or picked, then the
drawing tool, then out of the sketch; in other tools it backs out. With
something selected, right-click shows its tools by the pointer.
+100 -23
View File
@@ -64,36 +64,113 @@ export interface Settings {
*/
direct: boolean;
/**
* Which mouse drags turn and move the view (Settings > Mouse), for hands used to another program:
* right right drag turns; middle drag (or Shift + right) moves
* middle middle drag turns; Shift + middle moves; Ctrl + middle zooms
* shiftMiddle Shift + middle drag turns; middle drag moves; Ctrl + middle zooms
* ctrlMiddle middle drag turns; Ctrl + middle moves; Shift + middle zooms
* In all of them the wheel zooms, Alt + left drag turns, and a right drag turns too.
* Which mouse drags turn, move and zoom the view (Settings > Mouse): the app's own way, or the way of another
* CAD program, for hands used to it (see MOUSE_PRESETS). In all of them the wheel zooms, Alt + left drag turns,
* and a right drag turns too unless the preset uses it for something else.
*/
mouse: MouseStyle;
mouse: string;
/** The wheel rolled forward zooms out (it zooms in otherwise). */
wheelReverse: boolean;
}
export type MouseStyle = "right" | "middle" | "shiftMiddle" | "ctrlMiddle";
export type MouseNav = "orbit" | "pan" | "zoom";
/** What a mouse press on the view does to the view, in a style: null, nothing (the press is for the tools). */
export function mouseDrag(style: MouseStyle, button: number, keys: { shift: boolean; ctrl: boolean; alt: boolean }): "orbit" | "pan" | "zoom" | "right" | null {
/**
* A way of working the view with a mouse. `middle` and `right`: what a drag with that button does, by the keys
* held (`plain`, `shift`, `ctrl`, `both` for Ctrl + Shift; one not given falls back to `plain`). `chord`: what
* the middle button's drag becomes while another button is held with it (CATIA, NX, FreeCAD).
*/
export interface MousePreset {
id: string;
/** The programs that work this way (the row in Settings). */
apps: string;
/** What it does, in words. */
text: string;
middle: { plain: MouseNav; shift?: MouseNav; ctrl?: MouseNav; both?: MouseNav };
right?: { shift?: MouseNav; ctrl?: MouseNav };
chord?: { left?: MouseNav; right?: MouseNav };
}
/**
* The presets. Asked for: "it should have controls presets from all major CAD apps". Each as its program's own
* help gives it (2026-11); programs that work the same way share a row. The wheel's way round is its own switch
* (programs differ, and each lets it be turned over).
*/
export const MOUSE_PRESETS: MousePreset[] = [
{
id: "default",
apps: "superGeometry, Onshape, Tinkercad",
text: "Right drag turns the view. Middle drag moves it (also Shift or Ctrl + right drag).",
middle: { plain: "pan" },
right: { shift: "pan", ctrl: "pan" },
},
{
id: "fusion",
apps: "Fusion, Inventor, Revit, AutoCAD",
text: "Shift + middle drag turns the view. Middle drag moves it. Ctrl + Shift + middle drag zooms.",
middle: { plain: "pan", shift: "orbit", both: "zoom" },
right: { shift: "pan" },
},
{
id: "solidworks",
apps: "SolidWorks",
text: "Middle drag turns the view. Ctrl + middle drag moves it. Shift + middle drag zooms.",
middle: { plain: "orbit", ctrl: "pan", shift: "zoom" },
right: { shift: "pan" },
},
{
id: "creo",
apps: "Creo, Solid Edge, Blender, SketchUp",
text: "Middle drag turns the view. Shift + middle drag moves it. Ctrl + middle drag zooms.",
middle: { plain: "orbit", shift: "pan", ctrl: "zoom" },
right: { shift: "pan" },
},
{
id: "nx",
apps: "NX",
text: "Middle drag turns the view. Middle + right drag (or Shift + middle) moves it. Middle + left drag (or Ctrl + middle) zooms.",
middle: { plain: "orbit", shift: "pan", ctrl: "zoom" },
right: { shift: "pan" },
chord: { right: "pan", left: "zoom" },
},
{
id: "catia",
apps: "CATIA, FreeCAD",
text: "Middle drag moves the view. Hold the middle button and press the left or right one too: the drag turns it. Ctrl + middle drag zooms.",
middle: { plain: "pan", ctrl: "zoom" },
right: { shift: "pan" },
chord: { left: "orbit", right: "orbit" },
},
{
id: "rhino",
apps: "Rhino",
text: "Right drag turns the view. Shift + right drag moves it. Ctrl + right drag zooms. Middle drag moves it too.",
middle: { plain: "pan" },
right: { shift: "pan", ctrl: "zoom" },
},
];
/** The preset in use (one not known - an older setting - is the app's own). */
export function mousePreset(id: string): MousePreset {
return MOUSE_PRESETS.find((m) => m.id === id) ?? MOUSE_PRESETS[0];
}
/** What a mouse press on the view does to the view, in a preset: null, nothing (the press is for the tools). */
export function mouseDrag(id: string, button: number, keys: { shift: boolean; ctrl: boolean; alt: boolean }): MouseNav | "right" | null {
const preset = mousePreset(id);
if (button === 0) return keys.alt ? "orbit" : null;
// The right button: a drag turns the view, a click is the right-click (told apart as it moves). Shift: moves.
if (button === 2) return keys.shift ? "pan" : "right";
// The right button: a drag turns the view, a click is the right-click (told apart as it moves) - with a key, what the preset says.
if (button === 2) return (keys.ctrl ? preset.right?.ctrl : keys.shift ? preset.right?.shift : undefined) ?? "right";
if (button !== 1) return null;
switch (style) {
case "middle":
return keys.shift ? "pan" : keys.ctrl ? "zoom" : "orbit";
case "shiftMiddle":
return keys.shift ? "orbit" : keys.ctrl ? "zoom" : "pan";
case "ctrlMiddle":
return keys.ctrl ? "pan" : keys.shift ? "zoom" : "orbit";
default:
return "pan";
}
const m = preset.middle;
return (keys.ctrl && keys.shift ? (m.both ?? m.ctrl ?? m.shift) : keys.ctrl ? m.ctrl : keys.shift ? m.shift : undefined) ?? m.plain;
}
/** A middle drag while other buttons are held with it (`buttons` as a pointer event gives them): what it becomes, or null. */
export function mouseChord(id: string, buttons: number): MouseNav | null {
const chord = mousePreset(id).chord;
if (!chord || !(buttons & 4)) return null;
return (buttons & 1 ? chord.left : undefined) ?? (buttons & 2 ? chord.right : undefined) ?? null;
}
const DEFAULTS: Settings = {
@@ -127,7 +204,7 @@ const DEFAULTS: Settings = {
offline: false,
sentence: true,
direct: true,
mouse: "right",
mouse: "default",
wheelReverse: false,
version: 5,
};
+1 -1
View File
@@ -13,7 +13,7 @@ interface Entry {
const SECTIONS: { title: string; intro?: string; items: Entry[] }[] = [
{
title: "Getting around",
intro: "Drag with one finger or the right mouse button to turn the view, two fingers or the middle button to move it, pinch or scroll to zoom (Settings → Mouse has other mouse styles, for hands used to another program). With a mouse, a left drag on empty space draws a box to select with (bodies; with none in it, the closed shapes of a sketch), and Ctrl + A picks everything. While a shape is drawn, type its sizes: a number, Tab for the next size, Enter or a click to place it - with a mouse they show in tags by the pointer. Esc steps back: first what's half done or picked, then the tool, then out of the sketch. Right-click (on touch screens and headsets: press and hold still on an empty spot) opens a menu by the pointer: a tool's Done and Cancel, what can be done with what's picked, and the view's switches. A list opened from the line at the bottom stays up while the view is turned, moved or zoomed.",
intro: "Drag with one finger or the right mouse button to turn the view, two fingers or the middle button to move it, pinch or scroll to zoom (Settings → Mouse makes the mouse work as in another CAD program: Fusion, SolidWorks, Onshape, Creo, NX, CATIA, FreeCAD, Blender, Rhino and others). With a mouse, a left drag on empty space draws a box to select with (bodies; with none in it, the closed shapes of a sketch), and Ctrl + A picks everything. While a shape is drawn, type its sizes: a number, Tab for the next size, Enter or a click to place it - with a mouse they show in tags by the pointer. Esc steps back: first what's half done or picked, then the tool, then out of the sketch. Right-click (on touch screens and headsets: press and hold still on an empty spot) opens a menu by the pointer: a tool's Done and Cancel, what can be done with what's picked, and the view's switches. A list opened from the line at the bottom stays up while the view is turned, moved or zoomed.",
items: [
{ icon: "fit", name: "Fit", text: "Double-tap (or double-click) the view cube: zooms so everything fits on screen (F)." },
{ icon: "views", name: "View cube", text: "Tap a face of the cube for a straight-on view; ⟲ ⟳ at its top corners turn the view by 90°. Double-tap it to fit everything on screen." },
+12 -18
View File
@@ -7,7 +7,7 @@
import type { SavedView, Units, Vec3 } from "../doc/types";
import type { DocStore } from "../doc/store";
import { settings, type MouseStyle, type Settings } from "../settings";
import { MOUSE_PRESETS, mousePreset, settings, type Settings } from "../settings";
import { fmtLen as lenText, UNIT_LABEL, units } from "../units";
import type { Viewport } from "../view/viewport";
import type { UI } from "./ui";
@@ -105,20 +105,22 @@ export function setupRightColumn(ui: UI, view: Viewport, store: DocStore, onUnit
);
}), undefined, stash);
// Mouse: which drags turn and move the view - for hands used to another program (asked for by many: "a setting
// menu with a list", "in Fusion I have to use shift+middle"). Only where there is a mouse.
// Mouse: which drags turn, move and zoom the view - the app's own way or another CAD program's, for hands used
// to it (asked for by many: "a setting menu with a list: default, Autodesk, onshape, etc", then "it should have
// controls presets from all major CAD apps"). Only where there is a mouse.
lists.mouse = (host) => {
const s = settings.value;
host.append(heading("Turn and move the view"));
for (const [id, label, more] of MOUSE_STYLES) {
const row = choiceRow(label, s.mouse === id, () => (settings.set("mouse", id), ui.refreshPopover()));
row.title = more;
const now = mousePreset(s.mouse);
host.append(heading("Mouse like in"));
for (const m of MOUSE_PRESETS) {
const row = choiceRow(m.apps, now.id === m.id, () => (settings.set("mouse", m.id), ui.refreshPopover()));
row.title = m.text;
host.append(row);
}
host.append(el("div", "pop-note", MOUSE_STYLES.find((m) => m[0] === s.mouse)![2]));
host.append(el("div", "pop-note", now.text));
host.append(heading("Wheel"));
host.append(toggleRow("Forward zooms out", s.wheelReverse, (v) => settings.set("wheelReverse", v)));
host.append(el("div", "pop-note", "Always: the wheel zooms where the pointer is, a right drag turns the view, Alt + left drag turns it too (a trackpad), and a left drag on empty space draws a box to select with."));
host.append(el("div", "pop-note", "Always: the wheel zooms where the pointer is, a plain right drag turns the view, Alt + left drag turns it too (a trackpad), and a left drag on empty space draws a box to select with."));
};
// Views (standard and saved): the button at the view cube's bottom right.
@@ -236,7 +238,7 @@ export function setupRightColumn(ui: UI, view: Viewport, store: DocStore, onUnit
toggleRow("Number pad on screen", s.numpad, (v) => settings.set("numpad", v)),
nav("Appearance", `${s.ortho ? "Orthographic" : "Perspective"}${s.showGrid ? "" : " · no grid"}`, "appearance"),
);
if (matchMedia("(any-pointer: fine)").matches) host.append(nav("Mouse", MOUSE_STYLES.find((m) => m[0] === s.mouse)![3], "mouse"));
if (matchMedia("(any-pointer: fine)").matches) host.append(nav("Mouse", mousePreset(s.mouse).apps.split(",")[0], "mouse"));
},
() => UNIT_LABEL[units()],
);
@@ -251,14 +253,6 @@ export function setupRightColumn(ui: UI, view: Viewport, store: DocStore, onUnit
settings.onChange(() => ui.refreshRight());
}
/** The mouse styles: id, the row, what it does in full, and in a word (for the Settings row). */
const MOUSE_STYLES: [MouseStyle, string, string, string][] = [
["right", "Right drag turns", "Right drag turns the view. Middle drag (or Shift + right drag) moves it.", "Right turns"],
["middle", "Middle drag turns, Shift moves", "Middle drag turns the view. Shift + middle drag moves it, Ctrl + middle drag zooms.", "Middle turns"],
["shiftMiddle", "Shift + middle turns, middle moves", "Shift + middle drag turns the view. Middle drag moves it, Ctrl + middle drag zooms.", "Shift + middle turns"],
["ctrlMiddle", "Middle drag turns, Ctrl moves", "Middle drag turns the view. Ctrl + middle drag moves it, Shift + middle drag zooms.", "Middle turns, Ctrl moves"],
];
function heading(text: string): HTMLElement {
return el("div", "pop-heading", text);
}
+9 -1
View File
@@ -1,4 +1,4 @@
import { mouseDrag, settings } from "../settings";
import { mouseChord, mouseDrag, settings } from "../settings";
import { isHeadset, pickTolerance } from "../device";
// One input model for mouse, touch and pen (see docs/ARCHITECTURE.md §5).
@@ -150,6 +150,7 @@ export class InputRouter {
if (nav) {
// Right button: a drag orbits, a click is a "context" action (decided on move/up).
this.mode = nav === "right" ? "rpending" : nav;
this.navBase = nav === "right" ? null : nav;
return;
}
this.modifiers = e.ctrlKey || e.metaKey || e.shiftKey;
@@ -218,6 +219,11 @@ export class InputRouter {
t.y = y;
t.shift = e.shiftKey;
// A middle drag with another button held too (some programs' way to turn or zoom): what the preset says for
// it, and back to the middle button's own once that button is let go.
if (t.type === "mouse" && t.button === 1 && this.navBase && (this.mode === "orbit" || this.mode === "pan" || this.mode === "zoom")) {
this.mode = mouseChord(settings.value.mouse, e.buttons) ?? this.navBase;
}
switch (this.mode) {
case "rpending":
if (Math.hypot(x - t.x0, y - t.y0) >= TAP_SLOP.mouse) this.mode = "orbit";
@@ -316,6 +322,8 @@ export class InputRouter {
}
}
/** What the press that began this drag of the view does by itself (see the chord above). */
private navBase: "orbit" | "pan" | "zoom" | null = null;
private hoverAt: ToolPointer | null = null;
private hoverFrame = 0;
+34
View File
@@ -0,0 +1,34 @@
// Run: npx tsx tests/mousepresets.test.ts
// Settings > Mouse: what each press does to the view in each program's way (as its own help gives it).
import { MOUSE_PRESETS, mouseChord, mouseDrag, mousePreset } from "../src/settings";
let failed = 0;
const check = (name: string, ok: boolean, info: unknown = "") => {
if (!ok) failed++;
console.log(ok ? "ok " : "FAIL", name, info);
};
const K = (s = "") => ({ shift: s.includes("s"), ctrl: s.includes("c"), alt: s.includes("a") });
/** "m" middle, "sm" Shift + middle, "cm", "csm", "r" right, "sr", "cr", "al" Alt + left, "l" left. */
const press = (id: string, what: string) => mouseDrag(id, what.endsWith("m") ? 1 : what.endsWith("r") ? 2 : 0, K(what.slice(0, -1)));
const want: Record<string, Record<string, string | null>> = {
default: { m: "pan", sm: "pan", r: "right", sr: "pan", cr: "pan", al: "orbit", l: null },
fusion: { m: "pan", sm: "orbit", csm: "zoom", r: "right", al: "orbit", l: null },
solidworks: { m: "orbit", cm: "pan", sm: "zoom", r: "right", l: null },
creo: { m: "orbit", sm: "pan", cm: "zoom", r: "right", l: null },
nx: { m: "orbit", sm: "pan", cm: "zoom", r: "right", l: null },
catia: { m: "pan", cm: "zoom", r: "right", l: null },
rhino: { r: "right", sr: "pan", cr: "zoom", m: "pan", l: null },
};
check("a preset for each way", MOUSE_PRESETS.map((m) => m.id).sort().join() === Object.keys(want).sort().join(), MOUSE_PRESETS.map((m) => m.id).join());
for (const [id, presses] of Object.entries(want)) {
const got = Object.fromEntries(Object.keys(presses).map((k) => [k, press(id, k)]));
check(`${mousePreset(id).apps}: ${Object.entries(presses).map(([k, v]) => `${k} ${v}`).join(", ")}`, JSON.stringify(got) === JSON.stringify(presses), JSON.stringify(got) === JSON.stringify(presses) ? "" : JSON.stringify(got));
}
// Buttons held together (bit 1 left, 2 right, 4 middle).
check("NX: middle + right moves, middle + left zooms, middle alone nothing more", mouseChord("nx", 4 | 2) === "pan" && mouseChord("nx", 4 | 1) === "zoom" && mouseChord("nx", 4) === null);
check("CATIA, FreeCAD: middle + left or right turns", mouseChord("catia", 4 | 1) === "orbit" && mouseChord("catia", 4 | 2) === "orbit" && mouseChord("catia", 4) === null && mouseChord("catia", 2) === null);
check("the others have no buttons held together", ["default", "fusion", "solidworks", "creo", "rhino"].every((id) => mouseChord(id, 7) === null));
check("a setting not known (an older one) is the app's own way", mousePreset("shiftMiddle").id === "default" && press("whatever", "m") === "pan");
check("every preset says what it does, and names its programs", MOUSE_PRESETS.every((m) => m.text.length > 20 && m.apps.length > 1));
console.log(failed ? `${failed} FAILED` : "all passed");
process.exit(failed ? 1 : 0);