🎥 Make videos programmatically with React
Update TimelineInOutToggle.tsx
Jonny Burger39a75978c3f7
diff --git a/packages/cli/src/editor/components/TimelineInOutToggle.tsx b/packages/cli/src/editor/components/TimelineInOutToggle.tsxindex f2e7ae2a64..845bff28ed 100644--- a/packages/cli/src/editor/components/TimelineInOutToggle.tsx+++ b/packages/cli/src/editor/components/TimelineInOutToggle.tsx@@ -5,6 +5,7 @@ import React, {useImperativeHandle,} from 'react';import {Internals} from 'remotion';+import {useIsStill} from '../helpers/is-current-selected-still';import {useKeybinding} from '../helpers/use-keybinding';import {TimelineInPointer,@@ -34,6 +35,7 @@ export const TimelineInOutPointToggle: React.FC = () => {const {setInAndOutFrames,} = Internals.Timeline.useTimelineSetInOutFramePosition();+ const isStill = useIsStill();const videoConfig = Internals.useUnsafeVideoConfig();const keybindings = useKeybinding();@@ -46,6 +48,14 @@ export const TimelineInOutPointToggle: React.FC = () => {const biggestPossible =prev.outFrame === null ? Infinity : prev.outFrame - 1;const selected = Math.min(timelinePosition, biggestPossible);++ if (selected === 0) {+ return {+ ...prev,+ inFrame: null,+ };+ }+if (prev.inFrame !== null) {// Disable if already at this positionif (prev.inFrame === selected) {@@ -73,6 +83,13 @@ export const TimelineInOutPointToggle: React.FC = () => {prev.inFrame === null ? -Infinity : prev.inFrame + 1;const selected = Math.max(timelinePosition, smallestPossible);+ if (selected === videoConfig.durationInFrames - 1) {+ return {+ ...prev,+ outFrame: null,+ };+ }+if (prev.outFrame !== null) {if (prev.outFrame === selected) {return {@@ -123,12 +140,21 @@ export const TimelineInOutPointToggle: React.FC = () => {};});+ if (!videoConfig) {+ return null;+ }++ if (isStill) {+ return null;+ }+return (<><ControlButtontitle={getTooltipText('In (I)')}aria-label={getTooltipText('In (I)')}onClick={onInMark}+ disabled={timelinePosition === 0}><TimelineInPointercolor={inFrame === null ? 'white' : 'var(--blue)'}@@ -139,6 +165,7 @@ export const TimelineInOutPointToggle: React.FC = () => {title={getTooltipText('Out (O)')}aria-label={getTooltipText('Out (O)')}onClick={onOutMark}+ disabled={timelinePosition === videoConfig?.durationInFrames - 1}><TimelineOutPointercolor={outFrame === null ? 'white' : 'var(--blue)'}