Fix UI Builder shift-click resize without drag#6
Merged
Conversation
Shift-click near a corner used a generic 'corner' handle that applied both left and right (and top and bottom) in one move, shrinking the layer to the 8px minimum. Use directional corner handles, compute resize from mousedown origin geometry, and ignore gestures that never cross a small drag threshold so a click-in-place is a no-op.
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
Shift-clicking a selected layer on the UI Builder canvas to resize (without dragging) could shrink it to the minimum size and made recovery hard.
Causes
cornerhandle applied left and right (and top and bottom) in one update, so a click near a corner collapsed width/height to 8px.Fix
nw/ne/sw/seDRAG_THRESHOLD_PX(3px) of movement; click-in-place is a no-op and does not push historybuilderResize.tswith unit testsTest plan
pnpm --filter cli test(includes new resize unit tests)pnpm --filter web lintGreptile Summary
This PR fixes UI Builder resize gestures so shift-clicks do not resize selected layers. The main changes are:
Confidence Score: 5/5
Safe to merge with low risk.
The resize change is narrow, uses shared pure helpers, and has focused tests for the fixed behavior.
No files require special attention.
What T-Rex did
Important Files Changed
Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant User participant UI as UIBuilder participant Helpers as builderResize participant State as Builder state/history User->>UI: mouseDown on selected layer with Shift UI->>Helpers: getResizeHandle(layer, mx, my) Helpers-->>UI: directional handle or null UI->>UI: store origin geometry and pointer start User->>UI: mouseMove UI->>UI: compare movement with DRAG_THRESHOLD_PX alt movement below threshold UI-->>State: no geometry or history update else real drag UI->>Helpers: applyResizeHandle(handle, origin, pointer, snap) Helpers-->>UI: new bounds UI->>State: update selected layer geometry end User->>UI: mouseUp alt didDrag UI->>State: push pre-gesture state to history else click only UI-->>State: no history entry end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant User participant UI as UIBuilder participant Helpers as builderResize participant State as Builder state/history User->>UI: mouseDown on selected layer with Shift UI->>Helpers: getResizeHandle(layer, mx, my) Helpers-->>UI: directional handle or null UI->>UI: store origin geometry and pointer start User->>UI: mouseMove UI->>UI: compare movement with DRAG_THRESHOLD_PX alt movement below threshold UI-->>State: no geometry or history update else real drag UI->>Helpers: applyResizeHandle(handle, origin, pointer, snap) Helpers-->>UI: new bounds UI->>State: update selected layer geometry end User->>UI: mouseUp alt didDrag UI->>State: push pre-gesture state to history else click only UI-->>State: no history entry endReviews (1): Last reviewed commit: "Fix UI Builder shift-click resize collap..." | Re-trigger Greptile