feat: thumbnail grid, aspect-aware templates, and UI hierarchy polish

Material list:
- Switch asset list from one-per-row to a wrapping thumbnail grid
  (IconMode cards: thumbnail + corner checkbox + elided name, subfolder
  moved to tooltip).

Templates:
- Template.to_transform_state now contains-fits the print inside the
  target box by the print's native aspect ratio (no stretch); falls back
  to the box when print size is unknown.
- Feed print native size into template_panel for aspect-aware fitting.
- Shrink built-in template boxes to realistic print proportions.

UI hierarchy:
- Promote 打开文件夹 buttons to primary (filled accent).
- Add inline 归零 (reset angle) and a 重置位置/尺寸/角度 button to the
  transform panel; wire it to re-apply the selected template.
- Hide 保存 for built-in templates instead of leaving it greyed.

Docs: record template box/contain behavior (PRD) and the grid layout,
button hierarchy, and reset/save-visibility rules (UI design).
Tests: add 3 aspect-fit cases for to_transform_state.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 15:11:56 +08:00
co-authored by Claude Opus 4.8
parent df9145abdb
commit 8a34fe93ff
9 changed files with 273 additions and 78 deletions
+8 -8
View File
@@ -15,26 +15,26 @@ _TEMPLATES_FILENAME = "templates.json"
BUILTIN_TEMPLATES: List[Template] = [
Template(
name="正方形模板",
x_ratio=0.25, y_ratio=0.25,
width_ratio=0.50, height_ratio=0.50,
x_ratio=0.34, y_ratio=0.22,
width_ratio=0.32, height_ratio=0.32,
rotation=0.0, type="builtin",
),
Template(
name="纵向长方形模板",
x_ratio=0.30, y_ratio=0.15,
width_ratio=0.40, height_ratio=0.55,
x_ratio=0.35, y_ratio=0.16,
width_ratio=0.30, height_ratio=0.46,
rotation=0.0, type="builtin",
),
Template(
name="横向长方形模板",
x_ratio=0.15, y_ratio=0.30,
width_ratio=0.70, height_ratio=0.40,
x_ratio=0.27, y_ratio=0.26,
width_ratio=0.46, height_ratio=0.30,
rotation=0.0, type="builtin",
),
Template(
name="左胸小号模板",
x_ratio=0.35, y_ratio=0.28,
width_ratio=0.12, height_ratio=0.12,
x_ratio=0.50, y_ratio=0.22,
width_ratio=0.16, height_ratio=0.16,
rotation=0.0, type="builtin",
),
]