@@ -51,29 +51,24 @@ interface TimelineCachedKeyframe {
5151/**
5252 * Resolve a rendered timeline diamond back to the animation that authored it.
5353 * Flat tweens use synthesized diamonds, so a mixed flat tween may have neither
54- * a property group nor real keyframes. It is safe to fall back only when that
55- * flat tween is the selection's sole animation; multiple candidates remain
56- * unresolved rather than retiming an arbitrary tween.
54+ * a property group nor real keyframes. The cache currently carries a property
55+ * group, not an animation id, so resolution is safe only when that group has a
56+ * single candidate. Ambiguous candidates remain unresolved rather than
57+ * retiming an arbitrary tween.
5758 */
5859export function resolveTimelineKeyframeTarget (
5960 pct : number ,
6061 keyframes : ReadonlyArray < TimelineCachedKeyframe > ,
6162 animations : ReadonlyArray < TimelineKeyframeTargetAnimation > ,
6263) : { animId : string ; tweenPct : number } | null {
6364 const kf = keyframes . find ( ( item ) => Math . abs ( item . percentage - pct ) < 0.2 ) ;
65+ if ( ! kf ) return null ;
6466 const group = kf ?. propertyGroup ;
65- const groupedCandidates = group
67+ const candidates = group
6668 ? animations . filter ( ( animation ) => animation . propertyGroup === group )
67- : [ ] ;
68- const groupedKeyframed = groupedCandidates . find ( ( animation ) => animation . keyframes ) ;
69- const soleGroupedFlat =
70- groupedCandidates . length === 1 && ! groupedCandidates [ 0 ] ?. keyframes
71- ? groupedCandidates [ 0 ]
72- : undefined ;
73- const keyframed = animations . find ( ( animation ) => animation . keyframes ) ;
74- const soleFlat = animations . length === 1 && ! animations [ 0 ] ?. keyframes ? animations [ 0 ] : undefined ;
75- const animation = groupedKeyframed ?? soleGroupedFlat ?? keyframed ?? soleFlat ;
76- return animation ? { animId : animation . id , tweenPct : kf ?. tweenPercentage ?? pct } : null ;
69+ : animations . filter ( ( animation ) => ! animation . propertyGroup ) ;
70+ const animation = candidates . length === 1 ? candidates [ 0 ] : undefined ;
71+ return animation ? { animId : animation . id , tweenPct : kf . tweenPercentage ?? pct } : null ;
7772}
7873
7974/**
@@ -197,6 +192,9 @@ export function useTimelineEditCallbacks({
197192 decision . pctRemap ,
198193 ) ;
199194 } else {
195+ // resize-keyframed-tween requires an authored `keyframes` AST node
196+ // and intentionally no-ops for a flat tween. Update its real tween
197+ // window through the metadata writer (and SDK cutover path) instead.
200198 handleGsapUpdateMeta ( target . animId , {
201199 position : decision . position ,
202200 duration : decision . duration ,
0 commit comments