Skip to content

id(web): fix inverted west resize handles for images (#1389) - #1592

Merged
dezren39 merged 2 commits into
mainfrom
queue/1362-1389-west-resize
Oct 28, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/1362-1389-west-resize

Conversation

@dezren39

@dezren39 dezren39 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Fixes #1389.

startResize discarded the corner (_corner) and onResizeMove always computed startWidth + 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, and onResizeEnd persisted the wrong width/height attrs.

Changes

  • image-node-view.ts: store a per-drag dx sign in startResize (west corners nw/sw invert) and apply it in onResizeMove before 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.
  • image-node-view.test.ts (new, the component's first tests): all four corners' drag directions against a real 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 stub offsetWidth/offsetHeight from 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.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

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.
@dezren39
dezren39 requested a review from a team as a code owner October 28, 2026 04:56
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T04:58:26.214721Z 95e5e61 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 27c20e5e-cc28-4a95-ae18-a6ced96b200a
Commits

Reviewing files that changed from the base of the PR and between 1da6d84 and bf7b971.

Files selected for processing: 2
  • pkgs/id/web/src/image-node-view.test.ts
  • pkgs/id/web/src/image-node-view.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dezren39
dezren39 merged commit adb8cea into main Oct 28, 2026
32 checks passed
@dezren39
dezren39 deleted the queue/1362-1389-west-resize branch October 28, 2026 10:56
@dezren39
dezren39 restored the queue/1362-1389-west-resize branch November 1, 2026 07:48
@dezren39
dezren39 deleted the queue/1362-1389-west-resize branch November 1, 2026 16:44
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.

id(web): image resize west handles (nw/sw) drag in the wrong direction — outward shrinks, inward grows

1 participant