Skip to content

fix(inspector): drag the number itself to scrub a transform value (#87) - #90

Merged
HaD0Yun merged 1 commit into
mainfrom
fix/issue-87
Sep 3, 2026
Merged

fix(inspector): drag the number itself to scrub a transform value (#87)#90
HaD0Yun merged 1 commit into
mainfrom
fix/issue-87

Conversation

@HaD0Yun

@HaD0Yun HaD0Yun commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #87.

Root cause (two defects)

  1. NumberField only attached the scrub handlers to the axis badge; the number had none and showed a text caret.
  2. Even the badge drag barely worked: the Inspector field callbacks dropped NumberField's transaction token, so the first applied move went through store.applyAtomic, which settles the open transaction and cancels the drag after one pixel, leaving one stray undo entry.

Fix

  • The whole field is the hotspot. A press arms nothing; >= 4 px horizontal travel becomes a scrub (input blurred, transaction opened, ew-resize advertised), under the threshold it stays a plain click that focuses the number for typing.
  • Sensitivity is a fixed-travel rate (SCRUB_TRAVEL_PX = 220, same rule as the timeline curve editors): Position 5 m, Rotation 180 deg, Scale 4, otherwise step * 100. Shift = 0.25x, Alt = 0.1x.
  • Pure maths and the click-vs-drag state machine live in src/ui-scrub.js; Position/Rotation/Scale rows forward the token so a whole drag is exactly one undo entry.

Tests

  • New node suite test/verify-number-field-scrub.mjs (RED 6 failures on main, GREEN after).
  • New real-browser suite test/verify-number-field-scrub-browser.mjs (CDP): press on the Scale X number, +110 px -> 1 -> 3, exactly one history entry, plain click focuses with no entry. 13/13 PASS locally; 6 FAIL on main.
  • test/verify-object-gizmo.mjs identical before/after.

Scrubbing only started on the axis badge — a 15 px target next to the
number everyone actually aims at — and it barely worked when found: the
Inspector's field callbacks dropped NumberField's transaction token, so
the first applied move went through applyAtomic, which settles the open
transaction and cancels the drag. One pixel of travel, one stray undo
entry, then nothing.

The whole field is the hotspot now. A press arms nothing; past 4 px of
horizontal travel it becomes a scrub (focus taken back from the input,
transaction opened, ew-resize already advertising it), and under the
threshold it stays a plain click that focuses the number for typing —
no transaction, no history entry. The drag is tracked on the window
because a 40 px number is left behind within a few pixels of travel.

Sensitivity is a fixed-travel rate like the timeline's curve editors:
220 px sweeps one meaningful span (Position 5 m, Rotation 180°, Scale 4,
otherwise step * 100) instead of pixels * step, which made step 0.05
fields need 100 px for 5 units and step 1 fields bolt. Shift is a
quarter-speed pass; Alt keeps its finer one. The threshold, the rate and
the snapping live in src/ui-scrub.js so they are unit-testable, and the
Position/Rotation/Scale rows now hand the token back so a whole drag is
exactly one undo entry.
@HaD0Yun
HaD0Yun merged commit d2c2963 into main Sep 3, 2026
6 checks passed
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.

Inspector: 숫자 위에서 좌우 드래그로 값 조정이 안 됨 (스크럽 핫스팟이 축 글자뿐)

1 participant