fix: keep print and re-apply selected template on preview switch

Switching the preview garment cleared the scene (print lost), and
re-loading a print used the canvas's hard-coded centred default instead
of the selected template.

- template_panel: add apply_current() to re-emit the selected template
  for the current garment/print sizes and sync _current_state.
- main_window: remember the current print path, restore it after a
  garment switch, and call apply_current() after garment/print changes
  so the selected template stays sticky. Fine-tuned items are unaffected.
- Also feed template_applied into export_panel.set_transform to keep the
  single-export transform in sync.

Docs: record the sticky-template rule (PRD 6.6).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 15:39:45 +08:00
co-authored by Claude Opus 4.8
parent 8a34fe93ff
commit 69a6dc892a
3 changed files with 38 additions and 10 deletions
+1
View File
@@ -163,6 +163,7 @@
- 模板参数应基于衣服底图尺寸计算,避免只适配单一图片分辨率。
- 模板的 `width_ratio` / `height_ratio` 定义衣服上的**目标框**,而非强制拉伸尺寸。已知印花原始尺寸时,印花按自身宽高比缩放后 contain 进目标框并居中,不被拉伸变形;未知印花尺寸时退化为铺满目标框。
- 内置模板尺寸以贴近真实印花占比为准(例如正方形模板约为衣服宽度的 1/3),避免印花占据过大面积。
- 选中的模板是**粘性**的:在预览区切换衣服或切换印花时,印花不应丢失,应按当前选中模板基于新的衣服/印花尺寸重新计算落位,而非回退到画布的写死默认值。已手动微调的项不受影响,仍使用其自身参数。
### 6.7 自定义模板