Closed
Conversation
…/screen separation Replace hand-rolled trigonometry with gl-matrix mat2d and introduce a world/camera/screen coordinate system for the image cropper. - Add gl-matrix dependency, core/camera.ts module - Implement createCamera, worldToScreen, screenToWorld, restrictPanZoom - Implement createExportCamera for canvas export - Remove freeform/polygon code (deferred from MVP) - Migrate all hooks to use camera abstraction - CSS matrix() transform from camera mat2d - Fix pan restriction at non-zero rotation (visual aspect ratio bug) - Add image-cropper-next to storybook config and root tsconfig - 134 tests passing Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The crop rect lives in visual-normalized space where width and height are fractions of different pixel dimensions (visualW vs visualH). Aspect ratio comparisons must account for this. - rectangle-stencil: compare pixel aspect ratio during drag resize - story: use rotation-dependent visual aspect ratio (not natural) when computing crop rect for selected aspect ratio Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When aspectRatio is set on the Cropper component: - Only corner handles are shown (edge handles hidden) - Dragging a corner preserves the aspect ratio — the larger pixel delta drives, the other axis follows from the ratio - The opposite corner stays anchored - The crop rect is clamped to [0,1] bounds while maintaining ratio Also: - Add aspectRatio to StencilProps so it flows through the Cropper - Wire aspectRatio from Cropper to stencil component - Story passes aspectRatio to Cropper when a ratio is selected Co-Authored-By: Claude Opus 4.6 (1M context) <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.
Kapture.2026-03-16.at.10.48.34.mp4
What?
Closes
Why?
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast
Use of AI Tools