fix(inspector): drag the number itself to scrub a transform value (#87) - #90
Merged
Conversation
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
force-pushed
the
fix/issue-87
branch
from
September 3, 2026 14:36
2778201 to
fc0dd57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #87.
Root cause (two defects)
NumberFieldonly attached the scrub handlers to the axis badge; the number had none and showed a text caret.NumberField's transaction token, so the first applied move went throughstore.applyAtomic, which settles the open transaction and cancels the drag after one pixel, leaving one stray undo entry.Fix
ew-resizeadvertised), under the threshold it stays a plain click that focuses the number for typing.SCRUB_TRAVEL_PX = 220, same rule as the timeline curve editors): Position 5 m, Rotation 180 deg, Scale 4, otherwisestep * 100. Shift = 0.25x, Alt = 0.1x.src/ui-scrub.js; Position/Rotation/Scale rows forward the token so a whole drag is exactly one undo entry.Tests
test/verify-number-field-scrub.mjs(RED 6 failures on main, GREEN after).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.mjsidentical before/after.