Skip to content

fix: 合成テキストがバーコード幅を超えた場合にSVG幅を拡張する (#3) - #5

Merged
fumtas1k merged 2 commits into
mainfrom
develop
Apr 12, 2026
Merged

fix: 合成テキストがバーコード幅を超えた場合にSVG幅を拡張する (#3)#5
fumtas1k merged 2 commits into
mainfrom
develop

Conversation

@fumtas1k

@fumtas1k fumtas1k commented Apr 12, 2026

Copy link
Copy Markdown
Owner

変更内容

  • injectCompositeText でCourier Newモノスペースのメトリクス(~0.6em/文字)を使ってテキスト幅を推定するようにした
  • テキストがバーコード幅より広い場合、SVGの viewBox / width を拡張するようにした
  • バーコードを translate(offsetX, textRowH) で水平中央揃えに配置するようにした

テスト手順

  • GTINに加えて長いロット番号(例:VERYLONGLOTCODE123)を入力 → テキストが全て表示されることを確認
  • 短いロット番号の場合はレイアウトが変わらないことを確認
  • SVGダウンロード:ブラウザで開き、クリッピングがないことを確認
  • PNGダウンロード:2倍スケールで正しい寸法になっていることを確認

関連issue

🤖 Generated with Claude Code

fumtas1k and others added 2 commits April 12, 2026 14:41
When a lot number or other AI value is long, the composite text label
(e.g. "(17)251231(10)VERYLONGLOT") could be wider than the GS1 DataBar
symbol. `injectCompositeText` now estimates text width using Courier New
monospace metrics (~0.6em/char) and expands the SVG viewBox/width when
necessary, centering the barcode within the wider canvas.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: 合成テキストがバーコード幅を超えた場合にSVG幅を拡張する (#3)
@fumtas1k
fumtas1k merged commit 4e948ad into main Apr 12, 2026
2 checks passed
fumtas1k added a commit that referenced this pull request May 31, 2026
レビュー指摘対応。

- OutputField の className/statusClassName/textareaClassName の 3 つの
  エスケープハッチを単一の fill prop に置換し、内部 DOM 3 層へのレイアウト
  クラス付与をコンポーネント内にカプセル化(#2)
- fill 時は手動リサイズ(resize-y)と h-full の競合を避けるため resize-none を
  強制し managed height を保証(#3)
- エラー表示で入力カラムが伸びても items-stretch で左右カラム高さが揃うことを
  検証する E2E を追加。旧実装(items-start)で fail する陽性対照を確認済み(#4)
- 既存「デスクトップ幅で揃う」テストの許容値に根拠コメントを付与(#5)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ロットの文字数が多いと、表記が見切れる

1 participant