-
Notifications
You must be signed in to change notification settings - Fork 1
Imagekit Editor improvements #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: IK-2461/enhancements
Are you sure you want to change the base?
Imagekit Editor improvements #5
Conversation
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7663b96035
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } else if (focus === "coordinates") { | ||
| // Handle coordinate-based focus | ||
| // x/y are top-left coordinates, xc/yc are center coordinates | ||
| if (x) transforms.x = x | ||
| if (y) transforms.y = y | ||
| if (xc) transforms.xc = xc | ||
| if (yc) transforms.yc = yc | ||
| if (coordinateMethod === "topleft") { | ||
| if (x) transforms.x = x |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve focus coordinates when coordinateMethod is absent
This new gating on coordinateMethod means existing transformations saved before this change (which only stored focus: "coordinates" plus x/y or xc/yc) will no longer emit any coordinates unless coordinateMethod is set. In that case the formatter will silently drop the stored coordinates and the resulting crop will fall back to default positioning. Consider defaulting the branch when coordinateMethod is undefined (e.g., use x/y if present, otherwise xc/yc) to keep backward compatibility. The same pattern appears again in the imageLayer formatter.
Useful? React with 👍 / 👎.
|
@codex review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e00059e3bc
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (coordinateMethod === "topleft") { | ||
| if (x) transforms.x = x | ||
| if (y) transforms.y = y | ||
| } else if (coordinateMethod === "center") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve coordinate focus when coordinateMethod is absent
This formatter now only emits x/y or xc/yc when coordinateMethod is explicitly set to "topleft" or "center". Any existing transformations loaded via setTransformations that predate this field (i.e., focus=coordinates with x/y or xc/yc but no coordinateMethod) will silently drop their coordinates and produce a different crop. Consider defaulting coordinateMethod in the formatter (e.g., treat missing as topleft or fall back to whichever coordinates are present) to avoid breaking saved configs.
Useful? React with 👍 / 👎.
| if (val.focus === "coordinates") { | ||
| if (val.coordinateMethod === "topleft") { | ||
| if (!val.x && !val.y) { | ||
| ctx.addIssue({ | ||
| code: z.ZodIssueCode.custom, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow zero values in coordinate validation
The new validation treats 0 as falsy, so a valid coordinate like x=0 with y unset fails the “at least one coordinate” check. This blocks users from setting a top/left coordinate at exactly 0. Use explicit null/undefined/empty-string checks instead of !val.x/!val.y (same issue applies to the center coordinate branch below).
Useful? React with 👍 / 👎.
No description provided.