3e3e06b7a1e09cf1bbd787c217b62cb13bc95e51
Replace placeholder ImageCanvas with full QGraphicsView/QGraphicsScene editor: Layout: ImageCanvas(QWidget) = top bar + _CanvasView(QGraphicsView) + hint bar Top bar: garment/print filenames, mode buttons (移动/缩放/旋转, context-aware), zoom controls (−/% label/+, scroll wheel). _CanvasView: - drawBackground: checkerboard in garment area, gray outside - wheelEvent: zoom in/out anchored at cursor - mousePressEvent/mouseMoveEvent/mouseReleaseEvent: delegate to ImageCanvas Scene (1:1 with garment pixel coords): - garment QGraphicsPixmapItem at (0,0), not interactive - print QGraphicsPixmapItem positioned/rotated from TransformState - cosmetic selection rect (blue, 1.5px) - 4 corner handles (white circle, blue border) for scaling - rotation arm (dashed) + handle (blue circle) above top-center Interaction: - Hit test: rotation handle > corner handles > print body (priority order) - Move: delta in scene coords added to TransformState.x/y - Scale: _scene_to_local_xy() maps mouse to item local coords, computes new size keeping opposite corner fixed (_do_scale); supports aspect ratio lock via Shift or keep_aspect_ratio flag; correct with rotation - Rotate: atan2(mouse - center) + angle offset at press Coordinate helpers (static): - _local_to_scene_xy(lx, ly, state): item-local → scene - _scene_to_local_xy(sx, sy, state): scene → item-local (inverse rotation) Both use TransformState snapshot, not live item state, to avoid stale-pixmap issues. transform_changed signal fires on mouse release with final TransformState. Preview zoom changes only QGraphicsView transform; TransformState is unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cmbot
自动化图生图
Languages
Python
98.5%
PowerShell
1.5%