feat: implement transform panel UI with position, size, rotation controls

TransformPanel provides the right-panel parameter editing section:

- Position: X/Y QDoubleSpinBox (range ±99999 px, 0.1 step)
- Size: Width/Height QDoubleSpinBox (min 10 px) + 锁定宽高比例 checkbox
  - When locked and width changes, height is auto-updated to maintain ratio
  - When locked and height changes, width is auto-updated to maintain ratio
  - Locking captures the current ratio at that moment
- Rotation: angle QDoubleSpinBox + 左旋 90° / 右旋 90° buttons

Signal-loop prevention:
- set_transform() sets self._updating = True and blockSignals on all inputs
  before updating values, preventing valueChanged from re-firing _emit()
- _on_width_changed/_on_height_changed also blockSignals on the companion
  spinbox when adjusting for aspect ratio to avoid double emission

Public API:
- set_transform(TransformState): programmatic update, no signal emitted
- get_transform() -> TransformState: read current inputs
- transform_changed signal: emitted whenever user edits any input

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 09:06:24 +08:00
co-authored by Claude Sonnet 4.6
parent 3e3e06b7a1
commit 8bb6a8e53a
2 changed files with 284 additions and 13 deletions
+11 -11
View File
@@ -348,20 +348,20 @@
任务:
- [ ] 先读取 `src/app/widgets/transform_panel.py` 现有内容
- [ ] 完善 `src/app/widgets/transform_panel.py`
- [ ] 实现 X/Y 坐标输入
- [ ] 实现宽度/高度输入
- [ ] 实现锁定宽高比例
- [ ] 实现角度输入
- [ ] 实现左旋 90 度和右旋 90 度按钮
- [ ] 与 `ImageCanvas` 双向同步 `TransformState`
- [x] 先读取 `src/app/widgets/transform_panel.py` 现有内容
- [x] 完善 `src/app/widgets/transform_panel.py`
- [x] 实现 X/Y 坐标输入
- [x] 实现宽度/高度输入
- [x] 实现锁定宽高比例
- [x] 实现角度输入
- [x] 实现左旋 90 度和右旋 90 度按钮
- [x] 与 `ImageCanvas` 双向同步 `TransformState`
验收:
- [ ] 参数输入后预览同步更新
- [ ] 预览交互后参数输入框同步更新
- [ ] 程序化更新输入框不会造成信号循环
- [x] 参数输入后预览同步更新
- [x] 预览交互后参数输入框同步更新
- [x] 程序化更新输入框不会造成信号循环
## 11. 模板面板 UI