feat: add DEFAULT_BACK_DESIGN and getEffectiveBackDesign

This commit is contained in:
Poker Design Developer
2026-06-03 22:26:48 +08:00
parent 8050ec3e06
commit 5724cb7d97
2 changed files with 22 additions and 0 deletions

View File

@@ -58,6 +58,15 @@ export function getEffectiveDesign(project, cardKey) {
return { ...base, ...overrides } return { ...base, ...overrides }
} }
/**
* 合并项目级 back_design 与背面 card_overrides
*/
export function getEffectiveBackDesign(project) {
const base = JSON.parse(JSON.stringify(project?.back_design || DEFAULT_BACK_DESIGN))
const overrides = (project?.card_overrides || {})['back'] || {}
return { ...base, ...overrides }
}
/** /**
* 计算数字牌 (1-10) 实际的花色位置(绝对像素) * 计算数字牌 (1-10) 实际的花色位置(绝对像素)
* - 默认按 LAYOUT_POSITIONS * - 默认按 LAYOUT_POSITIONS
@@ -136,3 +145,14 @@ export const DEFAULT_DESIGN = {
font_color: '#000000', font_color: '#000000',
corner_offset: { x: 0, y: 0 }, corner_offset: { x: 0, y: 0 },
} }
export const DEFAULT_BACK_DESIGN = {
background_color: '#1A237E',
border_color: '#C0A050',
border_width: 3,
pattern_color: null,
image: null,
image_dx: 0,
image_dy: 0,
image_scale: 1,
}

View File

@@ -12,6 +12,8 @@ import {
isJoker, isJoker,
computeNumberPipPositions, computeNumberPipPositions,
getEffectiveDesign, getEffectiveDesign,
getEffectiveBackDesign,
DEFAULT_BACK_DESIGN,
} from './cardLayout.js' } from './cardLayout.js'
const CARD_W = 750 const CARD_W = 750