Value fields step with the arrow keys and the mouse wheel (#2320) (#2608)

* claim: #2320

* Value fields step with the arrow keys and the mouse wheel (#2320)

Up/Down in a focused value field step a plain number by 1 in the unit it is written in
("20 mm" -> "21 mm", "2,5 mm" -> "3,5 mm"), 10 with Shift and 0.1 with Alt; the wheel over
the focused field does the same, a step a notch, instead of scrolling the panel under it.
Expressions such as `width / 2` are left as typed, and an open completion list keeps the
arrows. Every expression field gets this through `params_dialog::complete`: the value box
beside the geometry in every dialog, the dialog rows, sketch dimensions, the dimension
editor, Drive Joint and the Parameters window.

* The value box beside the geometry stays under the pointer

The box rides on the arrow's tip, so each wheel notch that stepped its value moved it, and
after a notch or two the box slid out from under the pointer and the wheel zoomed the view
instead. While the pointer is over it the box now keeps its place, and it goes back to the tip
when the pointer leaves.

* Value stepping is a preference, off by default

Preferences › General › "Step values with the arrow keys and the wheel" (`step_values`,
also through `ui.prefs`) turns on Up/Down and wheel stepping in value fields, and the value
box staying under the pointer while the wheel steps it. Off, as by default, value fields
behave as before: Up/Down move the text cursor, the wheel scrolls, and the box beside the
geometry follows its arrow.

* Value stepping test: Bend Radius is under Advanced now

* Value stepping test: the preference is on the Design page

* Value stepping test: draw the field straight into the test's frame (#2320)

The shared outer-host rule now covers tests too; the field needs no panel around it.
This commit is contained in:
Ahmad Khan
2026-10-25 05:34:03 +00:00
committed by GitHub
parent 919f54a23e
commit a49698ee3d
14 changed files with 607 additions and 6 deletions
+7
View File
@@ -31,6 +31,13 @@ applies what you typed, and **Up/Down** picks one of them first. A unit right af
(`10 mm`) is left alone; anywhere else a unit is a prefix like any other, so `rad` followed by
**Enter** gives `radius`.
With **Preferences › Design › Step values with the arrow keys and the wheel** on (it is off
by default) and no suggestions open, **Up/Down** step a plain number in any value field (a dialog's rows,
the value box beside the geometry, a sketch dimension, a parameter's expression) by 1 in the
unit it is written in: `20 mm` becomes `21 mm`, `2,5 mm` becomes `3,5 mm`. Hold **Shift** for 10
or **Alt/Option** for 0.1. The mouse wheel over the focused field does the same, a step a notch,
and the preview follows each step. An expression such as `width / 2` is left as typed.
Expressions are unit-aware: `2 * width + 5 mm`, `angle / 2`, `sqrt(area)`, `1 in + 3 mm`, using
`+ - * / ^`, parentheses, `sin cos tan asin acos atan atan2 sqrt abs min max floor ceil round mod
trunc` and unit conversion. A decimal comma works too, outside parentheses: `2,5 mm` is
+3 -1
View File
@@ -62,7 +62,9 @@ Keys handled by the window itself:
While a value box has the keyboard (a dimension being added, a dialog field), keys type into
it and single-letter shortcuts don't fire. With Sketch Dimension (D), the box opens as soon as
you click a line, circle or arc (or the second point or line), so D, click, type the value,
Enter.
Enter. With Preferences › Design › Step values with the arrow keys and the wheel on, ↑ ↓ in a
value box, or the wheel over it, step a plain number by 1 (with Shift by 10, with Alt by 0.1);
see [Parameters and expressions](parameters.md).
Mouse and touch: