Repository navigation
id(web): fix inverted west resize handles for images (#1389) - #1592
Conversation
startResize discarded the corner and onResizeMove always computed startWidth + dx. The nw/sw handles sit on the left edge, so for them dragging outward shrank the image and dragging inward grew it, and mouse-up persisted the wrong width/height attrs. Store a dx sign per drag (west corners invert) and apply it in onResizeMove before the existing 50px min-width and editor max-width clamps; east handles are unchanged. Adds image-node-view.test.ts (the component's first tests): all four corners against a real EditorView, both clamps after the sign fix, and the committed width/height attrs on mouse-up. happy-dom has no layout, so the tests stub offsetWidth/offsetHeight from the inline style, which is what a real browser layout would report.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 57 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…erload fails typecheck TS2345 (#1389)
Fixes #1389.
startResizediscarded the corner (_corner) andonResizeMovealways computedstartWidth + dx. The nw/sw handles sit on the left edge, so for them the formula was inverted: dragging outward shrank the image, dragging inward grew it, andonResizeEndpersisted the wrong width/height attrs.Changes
startResize(west cornersnw/swinvert) and apply it inonResizeMovebefore the existing 50px min-width and editor max-width clamps, so the clamps bound the final width for every corner. East handles (ne/se) are unchanged, and aspect ratio handling is untouched.EditorView, min/max clamps after the sign fix, and the committed width/height attrs on mouse-up. happy-dom has no layout engine, so the tests stuboffsetWidth/offsetHeightfrom the img's inline style — what a real browser's layout would report — and the editor DOM width for the max clamp.Verification
CI on this PR (
test-web-unit,test-web-typecheck, formatters) per the fleet's CI-first policy.Need help on this PR? Tag
@codesmith-botwith what you need.