fix(studio): retime the dragged element's own keyframe

Drag-to-retime resolved the dragged diamond against the selected element's
animations and committed through the selected element's DOM selection, so
dragging a diamond on a non-selected clip retimed the wrong tween. It now
resolves against the clicked element's animations and commits through that
element's selection, matching the delete path.

The three diamond callbacks also take the TimelineKeyframeTarget they already
had instead of five positional fields, and the two copies of the
sourceFile#domId split share splitTimelineElementKey.
This commit is contained in:
Miguel Angel Simon Sierra
2026-07-27 19:52:07 +02:00
parent 3f93794fa6
commit 8f66b06d12
8 changed files with 166 additions and 95 deletions
@@ -298,6 +298,20 @@ export function buildTimelineElementKey(params: {
return `${scope}:${params.id}:${params.fallbackIndex}`;
}
/**
* Inverse of {@link buildTimelineElementKey} for the `sourceFile#domId` form.
* A key with no `#` is a bare dom id and carries no source file of its own, so
* the caller supplies the scope it wants to look that id up in.
*/
export function splitTimelineElementKey(key: string): {
sourceFile: string | null;
domId: string;
} {
const hashIndex = key.lastIndexOf("#");
if (hashIndex < 0) return { sourceFile: null, domId: key };
return { sourceFile: key.slice(0, hashIndex), domId: key.slice(hashIndex + 1) };
}
export function buildTimelineElementIdentity(params: {
preferredId?: string | null;
label: string;