fix: 大小王角标不显示 & 导出整副牌失效

This commit is contained in:
Poker Design Developer
2026-06-01 22:20:57 +08:00
parent b0cdd8c3ad
commit 35529e3738
3 changed files with 22 additions and 10 deletions

View File

@@ -363,14 +363,14 @@ def draw_back(canvas, design, asset):
body_w = w - 2 * body_pad_x
body_h = h - body_pad_y_top - body_pad_y_bot
if asset:
try:
image_dx = float(design.get('image_dx', 0))
image_dy = float(design.get('image_dy', 0))
image_scale = float(design.get('image_scale', 1))
offset_x = int(body_w * image_dx)
offset_y = int(body_h * image_dy)
if asset:
try:
img = asset.copy()
if image_scale != 1:
sw = max(1, int(img.width * image_scale))

View File

@@ -316,16 +316,25 @@ async function drawJokerBody(ctx, w, h, which, design, project) {
const labelSize = Math.max(20, Math.round(w * 0.06))
const textSize = Math.max(16, Math.round(w * 0.045))
const pad = Math.max(10, w * 0.04)
// 左上角标
ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif`
ctx.fillText('JOKER', pad, pad)
ctx.fillText(label, pad, pad + textSize + 4)
// 右下:旋转 180° 平移
// 右下角标
ctx.save()
ctx.translate(w - pad, h - pad)
ctx.rotate(Math.PI)
ctx.fillStyle = '#FFFFFF'
ctx.textAlign = 'left'
ctx.textBaseline = 'top'
ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif`
ctx.fillText('JOKER', 0, 0)
ctx.fillText(label, 0, textSize + 4)
ctx.restore()
ctx.restore()
}
async function drawBackSide(ctx, w, h, design, project) {

View File

@@ -241,10 +241,13 @@ async function onNameBlur() {
async function exportAll() {
try {
const r = await axios.post(`/api/projects/${project.value.id}/export/`,
{ resolution: 'standard', cards: 'all' },
{ responseType: 'blob' }
{ resolution: 'standard', cards: 'all' }
)
download(r.data, `${project.value.name || 'cards'}.zip`)
const { download_url, failed } = r.data
if (failed && failed.length > 0) {
alert('部分牌导出失败: ' + failed.map(f => f.card).join(', '))
}
window.open(download_url, '_blank')
} catch (e) {
alert('导出失败: ' + e.message)
}