Commit Graph

16 Commits

Author SHA1 Message Date
Developer
7417a4a893 feat: 模板预设机制 - 4 套模板各绑一组 JQK/Joker + 背景
经典 → 古典宫廷(王子/皇后/国王/小丑)
现代 → 现代人物(小孩/女青年/男青年/小丑鱼)
卡通 → 现代人物 + 暖色调 + 圆边框
复古 → 简笔符号 + 深色边框 + 米色背景

后端:
- CardTemplate 新增 theme_id(绑预设主题)+ design_override(背景/边框/字体等覆盖)
- 新增 apply_template_to_project():把 LibraryAsset 复制到项目素材 + 写 design
- 创建项目时支持传 template_id,自动套用整套预设
- 模板列表 API 附加 library 预览(4 张图缩略)

前端 Home.vue:
- 4 套模板卡片每张带 4 张缩略图(来自 library 预览)
- 点模板一键创建项目 + 跳转到编辑器
- '新建空白项目' 保留为独立按钮

init_system 同步:4 套模板配置 + 应用到示例项目
2026-06-02 15:08:37 +08:00
Developer
5ca000b8ab feat: 预设素材库 - 4 套主题 × 4 张图 = 16 张 PNG
主题:classical 古典宫廷(王子/皇后/国王/小丑)
      modern    现代人物(小孩/女青年/男青年/小丑鱼)
      astronomy 天文(星星/月亮/太阳/黑洞)
      minimal   简笔符号(圆点/♀/♂/叉)

改动:
- 新增 LibraryAsset 模型(全局素材库,theme_id/role/asset_id 索引)
- 新增 seed_library 管理命令,用 Pillow 画 16 张 PNG 素材
- 新增 /api/projects/library/ 列表 API
- 新增 /api/projects/{pid}/library/{id}/apply/ 应用 API
  把预设素材复制到 projects/<pid>/joker 或 face_card 下,作为该牌位的素材
- AssetPanel 加 tab 切换:「我的素材」+「预设主题」,主题可筛选、点击套用到当前牌
- 修复 generate_card_png 的 joker asset 匹配 bug:which 应该是 card_key(含前缀)才能匹配 asset_key

设计要点:
- 预设素材只画上半身(y=0~150),下半留空,让系统的'自动对称'流水线正确工作
- 预设素材 PNG 200×300,深色描边 + 半透明浅色填充,在任意牌面背景上叠加都清晰
2026-06-02 14:39:52 +08:00
Developer
8a253132bb feat: 对称方式可选 - 垂直翻转 / 180° 旋转
为 JQK 人物图和大小王素材添加 symmetry_mode 字段:
- 'flip'(默认):下半身用垂直镜像(沿水平中线翻转,左右不变)
- 'rotate':下半身用 180° 旋转(上下颠倒 + 左右镜像)

改动:
- 后端 draw_face_card / draw_joker:根据 symmetry_mode 选不同的 PIL transpose
- 前端 cardRenderer.js:face card 和 joker 都用统一的分支:
  - flip: translate + scale(1, -1)
  - rotate: translate + rotate(Math.PI)
- DesignPanel.vue:JQK/大小王面板加下拉选择器,存到 card_overrides
2026-06-02 09:52:17 +08:00
Poker Design Developer
10eb05e675 fix: 对齐前后端 joker 渲染,消除预览与导出不一致 2026-06-01 22:23:15 +08:00
Poker Design Developer
35529e3738 fix: 大小王角标不显示 & 导出整副牌失效 2026-06-01 22:20:57 +08:00
Poker Design Developer
b0cdd8c3ad feat: 背面图案支持 + 大小王素材位置微调 + 10号牌pip修复 2026-06-01 21:48:51 +08:00
Developer
2a36aa593c 重构扑克牌设计系统:修复后端渲染bug,重写前端编辑器 2026-06-01 17:11:06 +08:00
Poker Design Developer
bde508dcfe Add background image upload and real-time layer editing
- Background layer: color picker (real-time) + image upload + clear
- Image preview shows in sidebar after upload
- Uploaded image scales to fill the card dimensions
- All layer properties now update canvas in real-time (no apply button needed)
- Border: color + thickness slider real-time
- Text: font size slider real-time
- Click canvas objects to select layer and sync properties
2026-05-31 22:53:08 +08:00
Poker Design Developer
ab7c6c4474 Make all canvas objects selectable and editable
- All objects now selectable on canvas (hasControls=false, lockMovement enabled)
- Clicking canvas objects syncs activeLayer
- Add property editor panel for bg/border/text layers
- Background: color picker to change fill color
- Border: color picker + thickness slider
- Text: font size slider
- Layer properties (fillColor, strokeColor, textSize) stored in layer state
2026-05-31 22:43:51 +08:00
Poker Design Developer
888b787d1e Add interactive layer management to Editor
- Click layer to toggle visibility and redraw canvas
- Click ▲/▼ buttons to reorder layers (z-index)
- Active layer highlighted with left red border
- Each layer now actually renders: bg/white, border/frame, pattern/suit symbol, text/corner labels
- Fix fabric.js imports (Canvas, FabricText, Rect)
2026-05-31 22:13:38 +08:00
Poker Design Developer
670ac0a917 Rebuild Home and Editor pages with simplified inline styles
- Replace Element Plus components with pure HTML/CSS
- Use inline styles for reliable rendering
- Fix templates URL duplicate path issue
- Insert template data (4 templates) via Django shell
- Clear Vite cache and restart both servers
2026-05-31 22:07:39 +08:00
Poker Design Developer
71193c30e6 Fix fabric.js v6 import error causing blank page
- Replace deprecated 'import { fabric } from fabric' with named imports
- Editor.vue: import Canvas, Rect, FabricText
- symmetry.js: import FabricImage, Rect, Group
- Clear Vite cache to rebuild dependencies
2026-05-31 21:52:20 +08:00
Poker Design Developer
48b6fb0a39 Fix frontend blank page issue
- Simplify Home.vue to avoid API loading errors
- Use built-in template data instead of API calls
- Add simple error handling for API requests
- Add test page for debugging
2026-05-31 19:35:53 +08:00
Poker Design Developer
5dbcebf7a2 Fix frontend blank page issues
- Fix router import path in main.js
- Handle Django REST Framework pagination format in API calls
- Add getTemplates function to project API
- Restart frontend development server
2026-05-31 18:40:56 +08:00
Poker Design Developer
0370e4018a Implement asset upload API and utility functions
- Add Asset and CardLayer model updates
- Create asset upload API endpoints
- Add AssetUploadDialog component
- Create card layout algorithms
- Implement symmetry generation utils
- Add template configurations
2026-05-31 15:33:50 +08:00
Poker Design Developer
48629736f4 Implement Django backend and Vue frontend structure
- Django backend with projects, templates, exports apps
- SQLite database models for Project, Asset, CardLayer
- REST API endpoints for project management
- Vue frontend with Vite, Element Plus, Fabric.js
- Home page for project selection
- Editor page with Fabric.js canvas integration
2026-05-31 14:55:01 +08:00