Skip to content

Preferences ▸ Units drive every length the UI shows and reads (M14.5) - #67

Merged
bflatastic merged 1 commit into
mainfrom
pr/preferences-units
Oct 5, 2026
Merged

bflatastic merged 1 commit into
mainfrom
pr/preferences-units

Conversation

@bflatastic

Copy link
Copy Markdown
Member

Fixes a reported bug: changing Preferences ▸ Units (for example General to Millimeters) didn't update the UI; everything stayed in points. Every length the UI shows and reads now follows the units, live.

  • M14.5: Preferences ▸ Units drive every length the UI shows and reads.
    • How document units and the preference fit together:
      • General is the open document's units (Document.units, saved with the file).
      • prefs.set {unitsGeneral} changes the open document's units in one undo step (none if unchanged). It is also what file.new starts in without units, and what shows with no document open.
      • Document Setup changes only that document.
      • The Preferences dialog opens with General set to the document's units, so the two never disagree.
      • Stroke and Type stay app-wide preferences.
    • General units now drive:
      • the Transform panel, Properties and Control bar X/Y/W/H (fields widened so "152.753 mm" fits);
      • Info, Align spacing, Tabs, paragraph indents and Pattern Options;
      • rulers (with fractional steps for large units) and the status-bar X/Y;
      • dialog distances: Move, shapes, Offset Path, Simplify, Split Into Grid, Artboard Options, effects, Transform Each, parameter dialogs, Save PDF bleed and marks;
      • New Document and the home-screen presets;
      • canvas readouts: size, move and Measure labels, and the Live Corners radius.
    • Type units drive font size, leading and baseline shift (Character, Properties, Info).
    • Stroke units now also drive the Appearance panel's weight, the Width tool readout and the Magic Wand's weight tolerance.
    • Typed units: a value with a unit ("5 mm", "12 pt") works in every field. Over MCP the new len_param makes offset, simplify tolerance, grid gutter and text size/leading accept them too. Length preferences show and accept units.
    • More units: all ten are choices (Feet & Inches, Meters, Yards and Feet added).
    • One shared formatter and parser: Session::unit / general_unit / type_unit / default_units, Unit::named / key / readout / number, and PrefKind::Length.
    • Crash fix: the length parser no longer panics on text that starts with a multi-byte character (for example "é5").

docs/mcp.md and docs/control-protocol.md describe the units behaviour.

Known limits:

  • "Numbers Without Units Are Points" and East Asian type options have no effect yet.
  • Spinner arrows step 1 pt in every unit, as the Stroke panel already did.

Checks

Rebased onto 0e31fc9 (#66). cargo xtask ci passes all 7 steps (fmt, clippy, test, assets, brands, layers, wasm): 1,984 tests, 0 failed.

  • Nothing dropped:
    • every test name on main still exists (1,961 → 1,981, no existing test changed);
    • command ids, UI_COMMANDS, menu entries and MCP tools are unchanged.
  • New tests:
    • headless frames showing mm in Transform, Properties, the Control bar, Info and the Move, Rectangle and Drop Shadow dialogs, plus Preferences and New Document;
    • format/parse round-trips for every unit;
    • Stroke and Type units;
    • undo and a native round-trip;
    • canvas labels.
  • Checked in the running app: panels, Move, Preferences, New Document and the drag readout all show mm.

🤖 Generated with Claude Code

The General unit is the active document's units: Preferences > Units >
General sets them (one undo step) and is the units new documents start
in (and the unit shown with no document open); Document Setup changes
only the document. The Transform panel, Properties, the Control bar, the
Info panel, rulers, the status bar, Align spacing, Tabs, paragraph
indents, Pattern Options, dialog distances (Move, shape sizes, path
dialogs, Artboard Options, effect distances, Transform Each, parameter
dialogs), New Document and the canvas measurement labels (smart-guide
sizes, moves, the Measure tool, the Live Corners radius) all follow it,
live. Units > Type drives font size, leading and baseline shift; Units >
Stroke also reaches the Appearance panel and the Magic Wand weight
tolerance. Typed units ("5 mm", "12 pt") work in any field; all ten
units are choices; length preferences show in their unit and accept a
unit; offset/simplify/grid/type-size params read typed units. Typed text
starting with a multi-byte character no longer panics the parser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant