fix: joker symmetry images positioned in top/bottom halves separately
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user