fix: keep dimension labels out from under the rotate handles - #99
Open
henmedia wants to merge 1 commit into
Open
fix: keep dimension labels out from under the rotate handles#99henmedia wants to merge 1 commit into
henmedia wants to merge 1 commit into
Conversation
Clicking a width or depth label often started a rotation instead of opening the dimension input. Measured in the editor at 1280x800 with a 20mm box: the bottom rotate handle's hit area covered 730 square px of the 51x26px label, with only 11.6px between their centres. Both sat at z-index 3, and the rotate handles render after the labels, so the handle took the pointer. Probing five points across the visible label, four landed on the rotate handle; only its left edge reached the label. The scale handles in the same overlay were unaffected because .transform-handle already sits at z-index 5, above the rotate handles. The overlap itself comes from a mismatch of units. Dimension marks are placed at a fixed *world* offset outside the edge they measure, so their screen distance shrinks towards nothing as you zoom out, while rotate handles sit at a fixed *pixel* offset. The two cross over at everyday zoom levels. Raising the world offset cannot fix that, it only moves the zoom level where they collide. - Dimension marks now keep a minimum screen distance from the edge they measure: 28px of rotate handle offset, plus 20px of its hit area, plus half a label. Rail, extension lines and label move together so the text never tears away from its own dimension line, and the extension lines simply grow. Zoomed-in views are untouched, the push is exactly zero once the projection already clears the minimum. - Dimension labels join the scale handles at z-index 5, so the control you can see is the control you hit. - The rotate handle hit area shrinks from 52px to 40px around its 26px glyph. Three quarters of the old grab area was invisible and reached well past anything the user could see. Rotate handle positions are untouched. The placement rule is a pure function in transformOverlayTypes with unit tests across the zoom range; neutering it fails two of the seven. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Summary
Clicking a dimension label often started a rotation instead of opening the input.
Before
After
What was happening
Measured in the editor at a 1280x800 viewport with a 20mm box:
Only the label's left edge was clickable. Both sat at
z-index: 3, and the rotate handles render after the labels, so the handle won the pointer. The scale handles in the same overlay were never affected, because.transform-handlealready sits atz-index: 5, above the rotate handles.The overlap itself is a mismatch of units. Dimension marks are placed at a fixed world offset outside the edge they measure, so their screen distance shrinks towards nothing as you zoom out, while rotate handles sit at a fixed pixel offset. The two cross over at everyday zoom levels. Raising the world offset does not fix that, it only moves the zoom level where they collide.
What changed
z-index: 5, so the control you can see is the control you hit.Rotate handle positions are untouched. An earlier attempt pushed the handles outward instead, which left the two upper ones floating above the object at every zoom level; that approach is not in this branch.
The placement rule is a pure function in
transformOverlayTypes, so it can be tested without a renderer.Testing
npm run typechecknpm run test— 271 tests in 47 files pass, 7 of them newThe new tests cover the projected offset from 0.5px to 320px across six outward directions: labels below the minimum are lifted to exactly the minimum, labels above it are not moved at all, the outward direction from the projection is preserved, the transition across the threshold is continuous, and degenerate input yields no push. Neutering the function makes two of the seven fail, so they do discriminate.
Manual check covered a box in the editor: dimension text now sits clear of the rotate glyphs, the dimension line and its extension lines follow the text, and the labels open the input on click.
Notes
DIMENSION_LABEL_MIN_SCREEN_OFFSET, if you would prefer a different distance or want it limited to the footprint marks.🤖 Generated with Claude Code