mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-10 22:20:14 +00:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user