feat: add DEFAULT_BACK_DESIGN and getEffectiveBackDesign
This commit is contained in:
@@ -58,6 +58,15 @@ export function getEffectiveDesign(project, cardKey) {
|
||||
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) 实际的花色位置(绝对像素)
|
||||
* - 默认按 LAYOUT_POSITIONS
|
||||
@@ -136,3 +145,14 @@ export const DEFAULT_DESIGN = {
|
||||
font_color: '#000000',
|
||||
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,
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import {
|
||||
isJoker,
|
||||
computeNumberPipPositions,
|
||||
getEffectiveDesign,
|
||||
getEffectiveBackDesign,
|
||||
DEFAULT_BACK_DESIGN,
|
||||
} from './cardLayout.js'
|
||||
|
||||
const CARD_W = 750
|
||||
|
||||
Reference in New Issue
Block a user