fix: 大小王角标不显示 & 导出整副牌失效
This commit is contained in:
@@ -363,14 +363,14 @@ def draw_back(canvas, design, asset):
|
|||||||
body_w = w - 2 * body_pad_x
|
body_w = w - 2 * body_pad_x
|
||||||
body_h = h - body_pad_y_top - body_pad_y_bot
|
body_h = h - body_pad_y_top - body_pad_y_bot
|
||||||
|
|
||||||
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:
|
if asset:
|
||||||
try:
|
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)
|
||||||
|
|
||||||
img = asset.copy()
|
img = asset.copy()
|
||||||
if image_scale != 1:
|
if image_scale != 1:
|
||||||
sw = max(1, int(img.width * image_scale))
|
sw = max(1, int(img.width * image_scale))
|
||||||
|
|||||||
@@ -316,16 +316,25 @@ async function drawJokerBody(ctx, w, h, which, design, project) {
|
|||||||
const labelSize = Math.max(20, Math.round(w * 0.06))
|
const labelSize = Math.max(20, Math.round(w * 0.06))
|
||||||
const textSize = Math.max(16, Math.round(w * 0.045))
|
const textSize = Math.max(16, Math.round(w * 0.045))
|
||||||
const pad = Math.max(10, w * 0.04)
|
const pad = Math.max(10, w * 0.04)
|
||||||
|
|
||||||
|
// 左上角标
|
||||||
ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif`
|
ctx.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif`
|
||||||
ctx.fillText('JOKER', pad, pad)
|
ctx.fillText('JOKER', pad, pad)
|
||||||
ctx.fillText(label, pad, pad + textSize + 4)
|
ctx.fillText(label, pad, pad + textSize + 4)
|
||||||
// 右下:旋转 180° 平移
|
|
||||||
|
// 右下角标
|
||||||
|
ctx.save()
|
||||||
ctx.translate(w - pad, h - pad)
|
ctx.translate(w - pad, h - pad)
|
||||||
ctx.rotate(Math.PI)
|
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.font = `bold ${labelSize}px ${design.font_family || 'Times New Roman'}, serif`
|
||||||
ctx.fillText('JOKER', 0, 0)
|
ctx.fillText('JOKER', 0, 0)
|
||||||
ctx.fillText(label, 0, textSize + 4)
|
ctx.fillText(label, 0, textSize + 4)
|
||||||
ctx.restore()
|
ctx.restore()
|
||||||
|
|
||||||
|
ctx.restore()
|
||||||
}
|
}
|
||||||
|
|
||||||
async function drawBackSide(ctx, w, h, design, project) {
|
async function drawBackSide(ctx, w, h, design, project) {
|
||||||
|
|||||||
@@ -241,10 +241,13 @@ async function onNameBlur() {
|
|||||||
async function exportAll() {
|
async function exportAll() {
|
||||||
try {
|
try {
|
||||||
const r = await axios.post(`/api/projects/${project.value.id}/export/`,
|
const r = await axios.post(`/api/projects/${project.value.id}/export/`,
|
||||||
{ resolution: 'standard', cards: 'all' },
|
{ resolution: 'standard', cards: 'all' }
|
||||||
{ responseType: 'blob' }
|
|
||||||
)
|
)
|
||||||
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) {
|
} catch (e) {
|
||||||
alert('导出失败: ' + e.message)
|
alert('导出失败: ' + e.message)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user