关键帧面板:时间 ruler + 跨属性吸附 + 黄色吸附线#175
Merged
Merged
Conversation
Port upstream KeyframesLane's editor affordances (Inspector/Keyframes/
KeyframesLane.swift). Dragging a keyframe diamond previously snapped only to the
playhead; now it snaps to the nearest of {playhead, clip start/end, every OTHER
property's keyframes} within ±5 frames (snapTargets, :201-216), and a panel-wide
yellow DASHED guide line shows while snapped (snapOverlay, :301-313, matching the
main timeline's SnapIndicator). The static tinted strip becomes a real tick ruler
reusing the shared chooseTicks/formatTimecode logic (as upstream's RulerView
reuses TimelineRuler).
- keyframeSnap.ts: pure snapFrame(candidate, targets, threshold) — nearest-wins,
deterministic ties, null when outside threshold. Unit-tested.
- KeyframesLaneRow: collects cross-property + clip-bound targets (excludes the
dragged property's own track, 1:1 with `where p != property`); reports the live
snapped frame up via onSnapChange; clears it on mouseup + mid-drag unmount.
- KeyframesPanel: lifts the snap-frame state (the line must span all rows);
renders the yellow dashed overlay; swaps the tinted strip for <KeyframesRuler>.
- KeyframesRuler.tsx: ResizeObserver-measured tick ruler, clip-relative frames.
- tokens.css: --status-warning (SwiftUI .yellow / systemYellow).
Preserved: playhead snap (now one target among many), moveKeyframe commit, live
diamond preview, context menu, stamp/clear, drag-cleanup. Frontend only.
Verified: pnpm build (tsc) clean; pnpm test 218 passed (incl. new snapFrame tests).
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.
概要
Inspector 关键帧面板的三个上游编辑器 affordance(
Inspector/Keyframes/KeyframesLane.swift)。此前拖动关键帧只吸附播放头。变更
snapTargets,where p != property跳当前属性轨)。snapOverlaydash[4,4],与主时间线 SnapIndicator 视觉一致)。状态提升到 KeyframesPanel(线需跨全部行)。chooseTicks(TimelineRuler 1:1 端口)+formatTimecode标签(如上游 RulerView 复用 TimelineRuler)。keyframeSnap.ts(puresnapFrame最近优先)+KeyframesRuler.tsx(ResizeObserver 测宽)+ tokens--status-warning(SwiftUI .yellow)。保留
播放头吸附(现为目标之一)、
moveKeyframe提交、diamond 实时跟随、右键菜单、stamp/clear、拖拽卸载清理。纯前端。测试
snapFrame单测(最近优先 / tie 确定性 / 边界包含 / 空目标 / 零阈值 / 组合目标)。pnpm build(tsc)绿;pnpm test218 通过(+ snapFrame 测试)。