Skip to content

Fix image cropping on Windows - #1144

Merged
alexmontesg merged 2 commits into
fix/GH-1137-rect-resizefrom
fix/1138-crop-cursor-windows
Aug 5, 2026
Merged

Fix image cropping on Windows#1144
alexmontesg merged 2 commits into
fix/GH-1137-rect-resizefrom
fix/1138-crop-cursor-windows

Conversation

@alexmontesg

Copy link
Copy Markdown
Contributor

Closes #1138

alexmontesg and others added 2 commits August 5, 2026 12:15
Draw crop anchors before resolving the pointer so a stationary cursor
receives the correct resize direction.

Closes #1138

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Refs #1138

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a Windows-specific UX bug in the SDK image crop mode where the resize/crop cursor (and thus crop interaction) could fail to appear when Ctrl is held and crop anchors are created under an already-positioned pointer. The change ensures crop anchors are synchronously drawn and the cursor is updated immediately based on the current pointer location, aligning behavior with issue #1138.

Changes:

  • Force a synchronous utilityLayer.draw() when entering crop mode via Ctrl/Cmd, ensuring the hit graph includes the newly rendered crop anchors immediately.
  • Add logic to re-evaluate the current pointer position on Ctrl/Cmd press and set the correct resize cursor if the pointer is already over a crop anchor.
  • Add/extend Vitest coverage for synchronous drawing and cursor update behavior; update changelogs to include the fix.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
docs/content/docs/main/changelog/5.x/5.2.1.mdx Documents the #1138 fix in the 5.2.1 changelog.
code/packages/sdk/src/nodes/image/image.ts Ensures crop-mode utility layer is drawn synchronously and updates cursor based on current pointer intersection with anchors.
code/packages/sdk/src/nodes/image/tests/image.test.ts Adds tests for synchronous draw order and cursor update when pointer is already over a crop anchor.
code/CHANGELOG.md Adds #1138 entry to the main code changelog.

@alexmontesg
alexmontesg marked this pull request as ready for review August 5, 2026 10:23
@alexmontesg
alexmontesg requested a review from jesusmpc August 5, 2026 10:23
@alexmontesg alexmontesg added the skip-release Skips the release creation label Aug 5, 2026
@alexmontesg
alexmontesg merged commit c66d4e1 into fix/GH-1137-rect-resize Aug 5, 2026
7 checks passed
@alexmontesg
alexmontesg deleted the fix/1138-crop-cursor-windows branch August 5, 2026 10:56
alexmontesg added a commit that referenced this pull request Aug 6, 2026
…#1139)

* fix(nodes-selection): scope back-shape re-target to transformer back node

Konva's Transformer parents both the drag-whole-selection
overdraw shape and the resize anchors/rotater. The re-target-on-
pointerdown logic (meant only for , to let a node underneath the
selection's bounding box be dragged instead) also fired for anchor
clicks. A corner anchor's hit area extends slightly past the node's
own shape, so hit-testing under it could resolve to an underlying node
(e.g. an image) and hijack the drag instead of resizing.

Guard the branch with selectedGroup.hasName('back') so anchor/rotater
mousedowns fall through to the native Konva drag.

Closes #1137

* test(nodes-selection): tighten hasName stub to assert 'back' guard

hasName: () => true accepted any name, so these tests would still
pass even if the pointerdown 'back' check regressed to match the
wrong transformer child. Scope the stub to name === 'back' so the
tests actually exercise the guard.

* chore(deps): update package-lock.json

Regenerate lockfile: bump transitive deps (babel 7.29.7 -> 7.29.8,
azure/identity subdeps) and refresh registry resolution URLs.

* docs: update release documentation

Document the 5.2.1 changelog and release checklist.

* fix(nodes-selection): scope back-shape listening toggle to itself

registerStagePointerMove toggled the whole Transformer's listening
attr to let clicks pass through the container's empty back overdraw.
Since Konva's isListening() climbs the parent chain, this disabled
every anchor/rotater too. None of the 4 conditions re-enabled
listening when the pointer landed on an anchor overlapping an
unrelated sibling shape, so listening got stuck false and anchors
stopped receiving hover/pointer events (no cursor change, no resize).

Toggle back.listening() directly instead: back is a sibling of the
anchors/rotater, not their parent, so it can never disable them.

Closes #1137

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix image cropping on Windows (#1144)

* fix(image): restore crop cursor on modifier press

Draw crop anchors before resolving the pointer so a stationary cursor
receives the correct resize direction.

Closes #1138

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(changelog): add crop cursor fix

Refs #1138

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(groups): restore post-render selection

* fix(groups): restore post-render selection

Select the rendered replacement after state changes so the transformer
does not retain destroyed nodes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(context-menu): preserve multi-selection

Keep all selected nodes in the menu when a member of the
selection is right-clicked.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs(changelog): finalize 5.2.1 notes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-release Skips the release creation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants