画布 Transform 手柄:拖拽移动/缩放选中片段(1:1 上游)#176
Merged
Merged
Conversation
…selected clip Port upstream TransformOverlayView: when a single visual clip is selected, draw a bounding box with 4 corner resize handles + a move surface over the composited preview canvas, committing to the clip's transform. Faithful to what upstream ACTUALLY has — corners only (no edge handles) and NO rotation handle (upstream sets rotation only via the Inspector field; grep atan2/rotationHandle across the upstream repo = zero hits), so neither is invented. - clip.ts: moveTransformByDelta (normalized center translate + canvas-edge/center snap when unrotated, preserving upstream's single-width-threshold quirk), rotateDeltaIntoLocalFrame (R(-theta) so a screen-space corner drag maps into the rotated box's local frame; move deltas stay raw, rotation-invariant), sampledTransform (topLeft/size/rotation samplers -> center Transform = upstream clip.transformAt(frame:), so the box tracks keyframed transform), and findSelectedVisualClip. resizeTransformFromCorner reused unchanged. 20 tests. - TransformOverlay.tsx: the box + handles; container pointerEvents:none with only the handles/move-surface interactive (never blocks the preview); local-optimistic drag preview, ONE setClipProperties on pointerup (avoids per-move undo-stack spam / IPC latency — KeyframesLaneRow's pattern). 6 render tests. - Preview.tsx: surgical mount inside the canvas div, gated on a single selected visual clip. 4 negative-mount tests. Scope cuts (documented in code): pink center-snap GUIDE LINES (functional snap ported, guide rendering not); text-clip fontScale resize (no applyTextStyle wired yet — text resizes via transform). On-canvas drag still needs a real-machine visual pass (headless/Dock-blocked here); tsc + unit tests are green. Verified: pnpm build (tsc) clean; pnpm test 239 passed (+30).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
画布上直接操作 Transform:选中单个可视片段时,在合成预览画布上显示带 4 个角手柄 + 移动面的包围盒,拖拽即改片段 transform。1:1 复刻上游
TransformOverlayView.swift的实际行为。关键 1:1 发现
上游只有 4 个角手柄,没有边手柄,也没有旋转手柄(旋转仅经 Inspector 数值字段设;全上游仓库 grep
atan2/rotationHandle零匹配)。故均未发明。角拖拽的屏幕 delta 经旋转祖先 = 已在局部系,move 命中区是独立未旋转兄弟 = 屏幕系——用rotateDeltaIntoLocalFrame(R(-θ))精确复刻这个非对称。变更
clip.ts:moveTransformByDelta(归一平移 + 未旋转时画布边/中心吸附,保留上游"单一宽度阈值"怪癖)、rotateDeltaIntoLocalFrame、sampledTransform(= 上游clip.transformAt(frame:),跟随关键帧位置/缩放/旋转)、findSelectedVisualClip。复用现有resizeTransformFromCorner。20 单测。TransformOverlay.tsx(新):包围盒 + 手柄;容器pointerEvents:none,仅手柄/移动面可交互(绝不挡预览);local-optimistic 实时预览,松手才setClipProperties(避撤销栈刷屏 / IPC 延迟,同 KeyframesLaneRow)。6 渲染测试。Preview.tsx:surgical 挂载于既有画布 div 内,仅单选可视片段时渲染。4 负路径测试。范围切分(代码内标注)
applyTextStyle未接线,文本暂经 transform 缩放)。测试
pnpm build(tsc)绿;pnpm test239 通过(+30)。