Skip to content

Commit 1e2b1b3

Browse files
authored
Merge pull request #12 from shvyac/claude/practical-turing
fix: text not displaying on background image
2 parents 4e74a57 + 4818aab commit 1e2b1b3

File tree

1 file changed

+40
-42
lines changed

1 file changed

+40
-42
lines changed

QSL_card_designer.html

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
.designer { background: #fff; flex: 1; position: relative; padding: 20px; border-radius: 8px; box-shadow: 1px 1px 4px #ddd; }
1313
.designer-area { position: relative; width: 500px; height: 320px; background: #eee; border: 2px dashed #bbb; border-radius: 8px; overflow: hidden; margin: 0 auto; }
1414
.designer-area.has-bg { width: auto; height: auto; min-height: 320px}
15-
.bg-image-input { margin-bottom: 14px;
15+
.bg-image-input { margin-bottom: 14px; }
1616
#designerBg {position: absolute;top:0;left:0;width:100%;height:100%;z-index:0;object-fit:cover;}
1717
.field { position:absolute; min-width: 48px; min-height: 21px; background: transparent; border:1px solid #888; border-radius:4px; padding:0px; cursor:move; -webkit-user-select: none; user-select: none; box-sizing:border-box; overflow:visible; text-align:center; display:flex; align-items:center; justify-content:center;}
1818
.field-resize-handle { position:absolute; width:10px; height:10px; right:0; bottom:0; cursor:se-resize; background:rgba(0,0,0,0.3);}
@@ -640,47 +640,45 @@ <h2>QSL Card Designer (QSLカードデザイナー)</h2>
640640
}
641641

642642
// フィールドを描画
643-
if (adifRecords.length > 0) {
644-
const rec = adifRecords[qsoIdx] || {};
645-
designerFields.forEach((f) => {
646-
const v = (rec[f.name] !== undefined ? rec[f.name] : "");
647-
const w = f.width || 160;
648-
const h = f.height || 16;
649-
const x = f.x || 0;
650-
const y = f.y || 0;
651-
652-
// フィールドの背景(透明なのでスキップ)
653-
// テキストを描画
654-
const fontSize = h * 1.0;
655-
656-
// フォント設定(無線局コールサインと相手局の場合のみカスタムフォント)
657-
let fontFamily = 'Arial, Meiryo, sans-serif';
658-
if ((f.name === 'STATION_CALLSIGN' || f.name === 'CALL') && f.fontFamily) {
659-
fontFamily = f.fontFamily;
660-
}
661-
ctx.font = `bold ${fontSize}px ${fontFamily}`;
662-
ctx.textAlign = 'center';
663-
ctx.textBaseline = 'middle';
664-
665-
// テキスト内容
666-
let text = '';
667-
if (f.showName !== false) {
668-
text = `${f.displayName}: ${v}`;
669-
} else {
670-
text = v;
671-
}
672-
673-
// 色設定(無線局コールサインと相手局の場合のみカスタムカラー)
674-
let textColor = '#000000';
675-
if ((f.name === 'STATION_CALLSIGN' || f.name === 'CALL') && f.color) {
676-
textColor = f.color;
677-
}
678-
679-
// テキストを描画
680-
ctx.fillStyle = textColor;
681-
ctx.fillText(text, x + w / 2, y + h / 2);
682-
});
683-
}
643+
const rec = adifRecords[qsoIdx] || {};
644+
designerFields.forEach((f) => {
645+
const v = (rec[f.name] !== undefined ? rec[f.name] : "");
646+
const w = f.width || 160;
647+
const h = f.height || 16;
648+
const x = f.x || 0;
649+
const y = f.y || 0;
650+
651+
// フィールドの背景(透明なのでスキップ)
652+
// テキストを描画
653+
const fontSize = h * 1.0;
654+
655+
// フォント設定(無線局コールサインと相手局の場合のみカスタムフォント)
656+
let fontFamily = 'Arial, Meiryo, sans-serif';
657+
if ((f.name === 'STATION_CALLSIGN' || f.name === 'CALL') && f.fontFamily) {
658+
fontFamily = f.fontFamily;
659+
}
660+
ctx.font = `bold ${fontSize}px ${fontFamily}`;
661+
ctx.textAlign = 'center';
662+
ctx.textBaseline = 'middle';
663+
664+
// テキスト内容
665+
let text = '';
666+
if (f.showName !== false) {
667+
text = `${f.displayName}: ${v}`;
668+
} else {
669+
text = v;
670+
}
671+
672+
// 色設定(無線局コールサインと相手局の場合のみカスタムカラー)
673+
let textColor = '#000000';
674+
if ((f.name === 'STATION_CALLSIGN' || f.name === 'CALL') && f.color) {
675+
textColor = f.color;
676+
}
677+
678+
// テキストを描画
679+
ctx.fillStyle = textColor;
680+
ctx.fillText(text, x + w / 2, y + h / 2);
681+
});
684682

685683
// PNGとしてダウンロード
686684
canvas.toBlob(function(blob) {

0 commit comments

Comments
 (0)