fix(studio): accept razor splits at the canvas clamp boundary (#1340)

This commit is contained in:
Carlos Alcaraz Gregor
2026-06-11 10:26:49 -04:00
committed by GitHub
parent 83662c11a8
commit c52165d1b6
3 changed files with 68 additions and 7 deletions
@@ -5,6 +5,22 @@ export { buildPatchTarget, readFileContent } from "../hooks/timelineEditingHelpe
/** Minimum distance (seconds) from clip boundaries to allow a split. */
export const SPLIT_BOUNDARY_EPSILON_S = 0.03;
/**
* True when splitTime leaves at least SPLIT_BOUNDARY_EPSILON_S on both sides
* of the cut. Inclusive at the epsilon offsets: the timeline canvas clamps
* edge clicks to exactly start/end ± epsilon, so the clamped value must pass.
*/
export function isSplitTimeWithinBounds(
splitTime: number,
clipStart: number,
clipDuration: number,
): boolean {
return (
splitTime >= clipStart + SPLIT_BOUNDARY_EPSILON_S &&
splitTime <= clipStart + clipDuration - SPLIT_BOUNDARY_EPSILON_S
);
}
export function canSplitElement(el: TimelineElement): boolean {
return (
!el.timelineLocked &&