fix: improve margin calculation and image alignment logic in canvas#144
Conversation
…ansformation logic
…ansformation logic
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
Walkthrough画像の長辺と下部テキスト領域を基準にキャンバス余白・画像Y座標の計算を更新し、フォント名のサニタイズとCSSフォント文字列の生成規則を変更しました。 Changesキャンバス描画更新
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the canvas rendering layout to improve margin calculation and image Y-positioning, targeting better visual balance for portrait compositions while also refining landscape behavior.
Changes:
- Reworked minimum margin sizing to be based on the image’s long edge, and recalculated minimum canvas height to stabilize layout across alignment modes.
- Introduced
calculateDrawYto centralize image vertical alignment logic (top vs center) with constraints to preserve text space. - Updated font-family sanitization/escaping for canvas text rendering, and refreshed
package-lock.jsonmetadata.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/canvas.ts | Updates margin/canvas sizing and vertical alignment logic; refines font-family handling for text rendering. |
| frontend/package-lock.json | Lockfile metadata adjustments (removes libc fields for certain optional deps). |
Files not reviewed (1)
- frontend/package-lock.json: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // 外側の引用符を正規化 | ||
| if ((trimmedFamily.startsWith('"') && trimmedFamily.endsWith('"')) || | ||
| (trimmedFamily.startsWith("'") && trimmedFamily.endsWith("'"))) { | ||
| trimmedFamily = trimmedFamily.slice(1, -1); | ||
| } |
余白の計算ロジックを修正し,縦構図における余白が広い/狭い問題を解消
付随して横構図での振る舞いも修正
fixed #69