fix: joker symmetry images positioned in top/bottom halves separately

This commit is contained in:
Poker Design Developer
2026-06-04 21:56:56 +08:00
parent 5e7eb5115d
commit 194e42a026

View File

@@ -300,15 +300,16 @@ async function drawJokerBody(ctx, w, h, which, design, project) {
ctx.drawImage(img, topX, topY, finalW, finalH)
// symmetry_mode: 'flip' 垂直翻转,'rotate' 180° 旋转
const symMode = design.symmetry_mode || 'flip'
const botY = padTop + offsetY + halfH + (halfH - finalH) / 2
if (symMode === 'rotate') {
ctx.save()
ctx.translate(topX + finalW, topY + finalH)
ctx.translate(topX + finalW, botY + finalH)
ctx.rotate(Math.PI)
ctx.drawImage(img, 0, 0, finalW, finalH)
ctx.restore()
} else {
ctx.save()
ctx.translate(topX, topY + finalH)
ctx.translate(topX, botY + finalH)
ctx.scale(1, -1)
ctx.drawImage(img, 0, 0, finalW, finalH)
ctx.restore()