mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-11 23:00:03 +00:00
fix(studio): harden keyframe editing semantics
This commit is contained in:
@@ -236,7 +236,7 @@ export function useGsapKeyframeOps({
|
||||
);
|
||||
|
||||
const moveKeyframe = useCallback(
|
||||
(
|
||||
async (
|
||||
selection: DomEditSelection,
|
||||
animationId: string,
|
||||
fromPercentage: number,
|
||||
@@ -247,18 +247,26 @@ export function useGsapKeyframeOps({
|
||||
// updateKeyframeCacheFromParsed re-keys the diamond from the fresh parse, so no
|
||||
// optimistic cache write is needed (mapping the tween-% to clip-% here would
|
||||
// duplicate that math). softReload mirrors remove-keyframe.
|
||||
void commitMutation(selection, mutation, {
|
||||
label: `Move keyframe to ${toPercentage}%`,
|
||||
softReload: true,
|
||||
}).catch((error) => {
|
||||
try {
|
||||
let changed = false;
|
||||
await commitMutation(selection, mutation, {
|
||||
label: `Move keyframe to ${toPercentage}%`,
|
||||
softReload: true,
|
||||
onResult: (result) => {
|
||||
changed = result.changed !== false;
|
||||
},
|
||||
});
|
||||
return changed;
|
||||
} catch (error) {
|
||||
trackGsapSaveFailure(error, selection, mutation, `Move keyframe to ${toPercentage}%`);
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
[commitMutation, trackGsapSaveFailure],
|
||||
);
|
||||
|
||||
const resizeKeyframedTween = useCallback(
|
||||
(
|
||||
async (
|
||||
selection: DomEditSelection,
|
||||
animationId: string,
|
||||
position: number,
|
||||
@@ -275,12 +283,20 @@ export function useGsapKeyframeOps({
|
||||
// Boundary drag-to-retime: the server re-keys keyframes in place + grows the
|
||||
// tween window, preserving _auto / per-keyframe ease / easeEach / outer ease.
|
||||
// softReload re-keys the diamonds from the fresh parse (mirrors moveKeyframe).
|
||||
void commitMutation(selection, mutation, {
|
||||
label: "Retime keyframe (resize tween)",
|
||||
softReload: true,
|
||||
}).catch((error) => {
|
||||
try {
|
||||
let changed = false;
|
||||
await commitMutation(selection, mutation, {
|
||||
label: "Retime keyframe (resize tween)",
|
||||
softReload: true,
|
||||
onResult: (result) => {
|
||||
changed = result.changed !== false;
|
||||
},
|
||||
});
|
||||
return changed;
|
||||
} catch (error) {
|
||||
trackGsapSaveFailure(error, selection, mutation, "Retime keyframe (resize tween)");
|
||||
});
|
||||
return false;
|
||||
}
|
||||
},
|
||||
[commitMutation, trackGsapSaveFailure],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user