Files
drawlogo/js/core/poster-store.js
T

31 lines
920 B
JavaScript

/**
* 画个标 · 海报工作台:状态与画布规格
* 海报与 LOGO/头像的差异:画布多规格(竖版/方形/横版/长图),保留原始比例,不归一化。
*/
const HGB_PosterStore = (function () {
'use strict';
/** 画布规格(逻辑像素,按 96dpi 近似) */
const SPECS = [
{ id: 'poster', name: '竖版海报', w: 900, h: 1200 },
{ id: 'square', name: '方形', w: 1000, h: 1000 },
{ id: 'wide', name: '横版横幅 16:9', w: 1200, h: 675 },
{ id: 'story', name: '竖版长图 9:16', w: 675, h: 1200 }
];
let state = {
specId: 'poster',
title: '',
sub: '',
desc: '',
plans: [],
activePlan: null
};
function get() { return state; }
function set(patch) { state = Object.assign({}, state, patch); }
function spec() { return SPECS.find(s => s.id === state.specId) || SPECS[0]; }
return { SPECS, get, set, spec };
})();