Trim transparent space on SVG and PNG exports#4
Conversation
Added `getPathBoundingBox` helper function in `assets/app.js` to compute the bounding box of traced items. Modified the SVG and PNG export logic to use the bounding box dimensions instead of the original image dimensions. Scaled and translated the traced path points by offsetting them based on the minimum bounding box coordinates. Adjusted custom texture offsets for both single image and pattern repeats to accurately place the fill inside the trimmed exports. Removed the white SVG `<rect>` background from the SVG export so that transparent space is maintained. Co-authored-by: TechJeeper <5033913+TechJeeper@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
When exporting as SVG or PNG, the exported template now properly trims the transparent space around the traced items. The export logic calculates the bounding box of the traced items, translates the output coordinates and texture offsets based on the bounding box, and sets the image boundaries to tightly fit the traced content. The background
<rect>element from the SVG export was also removed to maintain true transparency.PR created automatically by Jules for task 9547450208586712277 started by @TechJeeper