Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 9 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Code Review
This pull request introduces support for parsing the SVG viewBox attribute into a synfig::Rect member variable (view_box_), replacing the previous manual ox and oy offset calculations. However, several critical issues were identified in the review: a trailing comma in the constructor initializer list will cause a compilation error, there is a unit mismatch when initializing view_box_ depending on whether viewBox is specified, and the coordinate transformations in coor2vect and the canvas view-box output do not correctly center the coordinates or account for the minx and miny offsets of the viewBox.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if (approximate_zero(view_box_.get_width())) { | ||
| view_box_.maxx = view_box_.minx + width / kux; | ||
| } | ||
| if (approximate_zero(view_box_.get_height())) { | ||
| view_box_.maxy = view_box_.miny + height / kux; // kuy | ||
| } |
There was a problem hiding this comment.
There is a critical unit mismatch and coordinate system misalignment in how view_box_ is handled:
- Unit Mismatch: If
viewBoxis specified in the SVG,view_box_is stored in SVG user units (pixels). IfviewBoxis not specified, you are dividing bykuxhere, storing it in Synfig units. This makesview_box_have inconsistent units. - Coordinate Misalignment: In
coor2vect, you are centering coordinates around0,0usingview_box_.get_width() / 2. However, the Synfig canvasview-boxis set to[view_box_.minx, view_box_.miny, view_box_.maxx, view_box_.maxy](which is not centered around0,0ifminxandminyare0). This causes all imported elements to be placed completely outside the visible area of the canvas.
To fix this, view_box_ should always be kept in SVG user units (pixels). Then, the Synfig canvas view-box should be centered around 0,0 with a width and height scaled by kux.
if (approximate_zero(view_box_.get_width())) {
view_box_.maxx = view_box_.minx + width;
}
if (approximate_zero(view_box_.get_height())) {
view_box_.maxy = view_box_.miny + height; // kuy
}
Amen 🙏 |
5e8eb08 to
954c4e2
Compare
No description provided.