Imagekit Editor improvements#5
Imagekit Editor improvements#5hrhv merged 20 commits intoimagekit-developer:IK-2461/enhancementsfrom
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 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.
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.
💡 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.
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.
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.