Repository navigation
fix(main-editor): keep layers on a cropped image when the editor is r… - #871
Closed
saif-ellafi wants to merge 2 commits into
Closed
saif-ellafi wants to merge 2 commits into
saif-ellafi wants to merge 2 commits into
Conversation
…eopened Layer offsets were rescaled from the full decoded image, which still includes the crop zoom, so markers drifted when the editor body changed. Scale each history entry from the transform in effect for that entry, and keep pre-crop layers on the uncropped frame. Co-authored-by: Cursor <cursoragent@cursor.com>
A fresh editor decodes the uncropped base before import, so dividing by scaleUser shrank every layer. Scale pre-patch crops from the uncropped frame and cover save/reopen on a new editor.
Contributor
Author
|
I'll take this PR back. It does not solve the problem as I thought, and in some cases it makes it even worse. I am not sure how it can be solved, but I'll be disabling the crop tool to avoid frustrations. Thanks! |
1 of 7 tasks
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.
Hi, this PR has been AI-Assisted. I have found, reproduced, debugged, and tested the solution.
Description
Cropped layers drifted when the same image history was opened in a different editor layout. The crop stays a transform on the original image, and layer offsets are distances from the center of the editor body where they were placed. On import, every layer was rescaled from the full decoded image. That size still includes the crop zoom (
scaleUser), whilelastRenderedImgSizedoes not, so a marker placed on the cropped image moved relative to the picture as soon as the body size changed.The export now records the editor body. Each history entry is rescaled with the transform still in effect for that entry: a cropped entry follows the fitted crop window, and a pre-crop entry follows the uncropped frame (
originalRenderedSize), not the zoomed decode of a later crop. Undo after reopen therefore leaves pre-crop layers where they were placed.Related Issue: Closes #
Type of Change