Skip to content

🎥 Make videos programmatically with React

Hide trim outlines during rolling edits

Jonny Burgercf8e74adce5e
diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsx
index b495be5198..fefe4a8638 100644
--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx
@@ -153,6 +153,7 @@ type TimelineEdgeHighlightEdge = 'left' | 'right' | 'source-only';
type TimelineEdgeHighlightState = {
readonly edge: TimelineEdgeHighlightEdge;
readonly isDragging: boolean;
+ readonly showTrimOutline: boolean;
readonly isAtLimit: boolean;
};
@@ -224,6 +225,7 @@ export const TimelineEdgeHighlightProvider: React.FC<{
if (
previousEdge?.edge !== nextEdge?.edge ||
previousEdge?.isAtLimit !== nextEdge?.isAtLimit ||
+ previousEdge?.showTrimOutline !== nextEdge?.showTrimOutline ||
previousEdge?.isDragging !== nextEdge?.isDragging
) {
for (const listener of listeners.get(nodePathKey) ?? []) {
@@ -1138,12 +1140,19 @@ const useTimelineSequenceState = (props: TimelineSequenceProps) => {
const previousTouchingOverrideId =
previousTouchingSequence?.controls?.overrideId ?? null;
const startEdgeDrag = useCallback(
- (
- edge: TimelineEdgeHighlightEdge,
- highlightAdjacent: boolean,
- isDragging: boolean,
- targetNodePaths: readonly SequencePropsSubscriptionKey[],
- ) => {
+ ({
+ edge,
+ highlightAdjacent,
+ isDragging,
+ showTrimOutline,
+ targetNodePaths,
+ }: {
+ readonly edge: TimelineEdgeHighlightEdge;
+ readonly highlightAdjacent: boolean;
+ readonly isDragging: boolean;
+ readonly showTrimOutline: boolean;
+ readonly targetNodePaths: readonly SequencePropsSubscriptionKey[];
+ }) => {
if (targetNodePaths.length === 0) {
edgeHighlightController?.setHighlights([]);
return;
@@ -1179,6 +1188,7 @@ const useTimelineSequenceState = (props: TimelineSequenceProps) => {
nodePathKey,
edge: highlightEdge,
isDragging,
+ showTrimOutline,
})),
);
},
@@ -1196,12 +1206,13 @@ const useTimelineSequenceState = (props: TimelineSequenceProps) => {
isDragging: boolean,
targetNodePaths: readonly SequencePropsSubscriptionKey[],
) =>
- startEdgeDrag(
- mode === 'source-only' ? 'source-only' : 'left',
- mode === 'ripple' || mode === 'rolling',
+ startEdgeDrag({
+ edge: mode === 'source-only' ? 'source-only' : 'left',
+ highlightAdjacent: mode === 'ripple' || mode === 'rolling',
isDragging,
+ showTrimOutline: mode !== 'rolling',
targetNodePaths,
- ),
+ }),
[startEdgeDrag],
);
const startRightEdgeDrag = useCallback(
@@ -1209,12 +1220,13 @@ const useTimelineSequenceState = (props: TimelineSequenceProps) => {
isDragging: boolean,
targetNodePaths: readonly SequencePropsSubscriptionKey[],
) =>
- startEdgeDrag(
- 'right',
- !isTransitionSeriesSequence(s),
+ startEdgeDrag({
+ edge: 'right',
+ highlightAdjacent: !isTransitionSeriesSequence(s),
isDragging,
+ showTrimOutline: true,
targetNodePaths,
- ),
+ }),
[startEdgeDrag, s],
);
const clearEdgeHighlight = useCallback(() => {
@@ -1845,6 +1857,7 @@ const useTimelineSequenceState = (props: TimelineSequenceProps) => {
video,
dragAwareDoubleClick,
isEdgeDragging,
+ showTrimOutline: activeHighlight?.showTrimOutline ?? false,
activeEdgeHighlight,
activeTrimEdge,
isAtTrimLimit,
@@ -1928,6 +1941,7 @@ const TimelineSequenceLayoutInner: React.FC<{
video,
dragAwareDoubleClick,
isEdgeDragging,
+ showTrimOutline,
activeEdgeHighlight,
activeTrimEdge,
isAtTrimLimit,
@@ -2120,6 +2134,7 @@ const TimelineSequenceLayoutInner: React.FC<{
const trimOutline = (() => {
if (
!isEdgeDragging ||
+ !showTrimOutline ||
activeEdgeHighlight === null ||
activeEdgeHighlight === 'source-only' ||
s.loopDisplay ||