Skip to content

画布 Crop 编辑:暗区遮罩+三分线+角手柄+平移 + Inspector 开关/宽高比预设(1:1 上游)#178

Merged
appergb merged 1 commit into
mainfrom
feat/canvas-crop-overlay
Jul 2, 2026
Merged

画布 Crop 编辑:暗区遮罩+三分线+角手柄+平移 + Inspector 开关/宽高比预设(1:1 上游)#178
appergb merged 1 commit into
mainfrom
feat/canvas-crop-overlay

Conversation

@appergb

@appergb appergb commented Jul 2, 2026

Copy link
Copy Markdown
Owner

上游 CropOverlayView.swift + InspectorView cropRow/cropMenu 的 1:1 移植。裁剪编辑激活时预览画布用 CropOverlay 替换 TransformOverlay(互斥,PreviewContainerView:37-41);纯几何模块 32 单测;animated crop 走 upsertKeyframe。实现 agent 中途断线,已救回并修正其 3 个符号写反的测试(负 inset 不可能,上游同款 clamp)。本地:build 绿 + 324 测试。画布拖拽待真机目视。

…t-lock menu

Port upstream CropOverlayView.swift + InspectorView cropRow/cropMenu (T3-11):
while crop-editing is active for the selected visual clip, the preview canvas
swaps TransformOverlay for a CropOverlay — crop rect with dimmed outside, rule-
of-thirds guides, 4 corner handles (free or aspect-locked), drag-inside pan —
committing once on release (animated crop upserts a keyframe at the playhead).

- cropOverlay.ts: pure 1:1 drag math — pannedCrop, resizedCrop (free clamps
  insets >= 0 with MIN_VISIBLE floor exactly like upstream :144-147; locked
  drives one visible-width var with per-corner bounds), lockedAspectNormalized,
  CropAspectLock presets + cropFittingAspect/cropForPreset. 32 unit tests.
- CropOverlay.tsx: TransformOverlay's architecture (pointerEvents:none container,
  window pointer listeners + cleanup, sampledTransform/cropAt rest state,
  commit-on-release; rotated clips route corner deltas via
  rotateDeltaIntoLocalFrame).
- Preview.tsx: mutually exclusive mount per PreviewContainerView.swift:37-41.
- uiStore: cropEditingActive + cropAspectLock; cleared on selection change and
  on leaving the Video tab (InspectorView.swift:60-68 parity).
- Inspector CropSection: crop-edit toggle + aspect preset menu; applyCropPreset
  branches animated (upsert keyframe) vs static, free = lock-only (no mutation).
- dict.ts: zh/en labels.

Note: the implementing agent died mid-run (API disconnect); work was recovered,
3 of its tests expected impossible negative insets on an outward drag from the
identity crop — rewritten against a non-zero start plus an explicit floor-at-0
assertion (upstream clamps identically).

Verified: pnpm build (tsc) clean; pnpm test 324 passed. On-canvas drag still
needs a real-machine visual pass.
@appergb appergb merged commit e44874b into main Jul 2, 2026
2 checks passed
@appergb appergb deleted the feat/canvas-crop-overlay branch July 2, 2026 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant