Drawing modifiers — ortho, polar tracking, dynamic input
These apply across all draw tools (rect, polygon, path, circle, arc) and the Move/Stretch translation modes.
| Modifier | Default | Toggle | What it does |
|---|---|---|---|
| Ortho mode | off | F8 or status-bar ORTHO |
Constrains the next vertex / drag offset to horizontal or vertical. Hold Shift to invert (Shift always means "the opposite of current ortho"). |
| Polar tracking | off | F10 or status-bar POLAR n° |
Locks the cursor onto the nearest n-degree ray from the previous vertex when within tolerance. The default step is 45°; change it in Edit → Settings (1–180°). |
| Dynamic input HUD | always on during drafts | n/a | A small floating panel shows the live distance and angle from the previous vertex while drawing. See §10.1 for the typed-input grammar. |
Shift / Alt while drawing. Each draw tool reads the modifier keys the same way:
| Tool | Shift |
Alt |
|---|---|---|
| Rect | Constrain to a square | Grow from the center (the click point is the rect's middle, not a corner) |
| Circle | Polar-lock the radius cursor to a 45° ray (purely a cue — the circle itself is radially symmetric) | — |
| Arc | Lock the start angle (click 2) and the sweep (click 3) to 45° increments | — |
| Polygon / Path | Toggle ortho-lock — Shift always means "the opposite of the current ortho mode" for that one click |
— |
Shift+Alt on Rect combines: a square centered on the click. Modifier behavior is consistent with the surrounding ortho/polar settings — F8 (ortho) flips Shift's meaning for Poly/Path/Circle/Arc the same way it always has.
Cancel an in-progress draft any time with Esc, which works mid-drag (Rect / Circle), between vertex clicks (Poly / Path), or between arc phase clicks. Right-click also cancels — except while drawing a polygon, where a right-click instead closes the shape (commits the boundary as drawn, exactly like Enter). Right-clicking with nothing in flight opens the normal context menu.
OSNAP-style helpers (intersection, perpendicular foot, circle center) are always on while drafting and override polar/ortho when within tolerance — they're the most precise hit, so they win.
10.1 Coordinate input grammar (Dynamic Input HUD)
The HUD has two fields: distance (left) and angle (right). Tab swaps focus, Enter commits, Esc cancels. By default the distance field accepts a plain number and uses the live cursor angle, but it ALSO accepts AutoCAD-style coordinate strings — just type them into the distance field:
| Syntax | Meaning | Example | Resolves to |
|---|---|---|---|
x,y |
Absolute world point in the active display unit | 5,3 (in µm mode) |
(5000, 3000) nm |
@dx,dy |
Relative offset from the reference point (the previous vertex of the in-progress polyline / drag origin) | @5,3 after a vertex at (10,10) |
(15, 13) |
@d<θ |
Polar — distance d at angle θ (degrees CCW from +x) from the reference point |
@5<45 |
reference + (5cos45°, 5sin45°) |
Whitespace is ignored. Decimals are accepted (@2.5,1.5). Negative numbers work (@-5,0 for "5 units to the left"). Distances honour the active display unit (nm / µm / mm — Edit → Settings); angles are unitless degrees regardless.
The HUD picks the parser path automatically: if the string contains any of @, ,, or <, it's treated as a coord. Otherwise it's a plain numeric distance combined with the live cursor angle.
When does the parser run? While drafting any of:
- Polygon / Path: each click activates the HUD with the new vertex as the reference point. Type the next vertex's coord and press
Enterinstead of clicking. - Box / Circle: HUD activates on the first click; the second corner / radius point is what you type.
- Stretch translate & Move drags: the current cursor anchor is the reference; type a delta to translate the marked vertices by an exact offset.
Examples:
- Drawing a 10 µm × 5 µm rectangle from the origin: click
(0,0), then in the HUD type@10,5and pressEnter. - A 30° offset of 12 µm from the previous vertex: type
@12<30and pressEnter. - Place a polygon vertex at the absolute point
(100, 200)µm: type100,200and pressEnter.
Parser source: src/canvas/coordParse.ts. Returns { kind: 'absolute' | 'relative' | 'polar' | 'invalid' }; the HUD's resolveCoord step converts to a world-nm point using the active display unit and the reference. Invalid input falls through to the live-angle numeric interpretation, so a typo doesn't cancel your draft — it just commits at the cursor.