@@ -11,7 +11,6 @@ import {
1111} from "@core/animations/opacity-keyframes" ;
1212import type { Edit } from "@core/edit-session" ;
1313import { EditEvent } from "@core/events/edit-events" ;
14- import { hasKeyframedVisualProperty } from "@core/shared/clip-utils" ;
1514import { validateAssetUrl } from "@core/shared/utils" ;
1615import { ShotstackEdit } from "@core/shotstack-edit" ;
1716import type { ResolvedClip } from "@schemas" ;
@@ -949,20 +948,16 @@ export class MediaToolbar extends BaseToolbar {
949948 const fps = this . edit . getOutputFps ( ) ;
950949 const currentPoint = localTime === null ? undefined : findOpacityPoint ( visiblePoints , localTime , fps ) ;
951950
952- const hasEffect = Boolean ( clip . effect ) ;
953- const hasTransition = Boolean ( clip . transition ?. in || clip . transition ?. out ) ;
954- const hasPreset = hasEffect || hasTransition ;
955951 const animated = Array . isArray ( clip . opacity ) || ( points ?. length ?? 0 ) > 0 ;
956952 let disabledReason = "" ;
957953 if ( ! editable ) disabledReason = "This opacity animation can be previewed but not edited" ;
958954 else if ( isBound ) disabledReason = "Remove the merge field before keyframing opacity" ;
959- else if ( hasPreset ) disabledReason = "Remove the clip effect or transition before keyframing opacity" ;
960955 else if ( localTime === null ) disabledReason = "Move the playhead over the clip to edit opacity keyframes" ;
961956 else if ( currentPoint && points ?. length === 2 && points . some ( point => point !== currentPoint && point . time > clip . length + TIME_EPSILON ) ) {
962957 disabledReason = "Extend the clip before removing this keyframe" ;
963958 }
964959
965- this . opacitySlider ?. setEnabled ( ! isBound && editable && ( ! animated || ( ! hasPreset && localTime !== null ) ) ) ;
960+ this . opacitySlider ?. setEnabled ( ! isBound && editable && ( ! animated || localTime !== null ) ) ;
966961
967962 if ( this . opacityKeyframeBtn ) {
968963 let state : keyof typeof KEYFRAME_BUTTON_STATES = "static" ;
@@ -979,23 +974,6 @@ export class MediaToolbar extends BaseToolbar {
979974 const navigationTime = this . edit . playbackTime - clip . start ;
980975 if ( this . opacityPreviousKeyframeBtn ) this . opacityPreviousKeyframeBtn . disabled = ! findOpacityPoint ( visiblePoints , navigationTime , fps , - 1 ) ;
981976 if ( this . opacityNextKeyframeBtn ) this . opacityNextKeyframeBtn . disabled = ! findOpacityPoint ( visiblePoints , navigationTime , fps , 1 ) ;
982-
983- // Only committed keyframes gate presets. An armed-but-unwritten point has no
984- // document presence, so gating on it would disable controls with nothing to undo.
985- const hasVisualKeyframes = hasKeyframedVisualProperty ( clip ) ;
986- this . setPresetButtonEnabled ( this . effectBtn , ! ( hasVisualKeyframes && ! hasEffect ) , "Effects can't be combined with keyframes in the editor" ) ;
987- this . setPresetButtonEnabled (
988- this . transitionBtn ,
989- ! ( hasVisualKeyframes && ! hasTransition ) ,
990- "Transitions can't be combined with keyframes in the editor"
991- ) ;
992- }
993-
994- private setPresetButtonEnabled ( button : HTMLButtonElement | null , enabled : boolean , disabledReason : string ) : void {
995- if ( ! button ) return ;
996- Object . assign ( button , { disabled : ! enabled , title : enabled ? "" : disabledReason } ) ;
997- if ( enabled ) button . removeAttribute ( "aria-label" ) ;
998- else button . setAttribute ( "aria-label" , disabledReason ) ;
999977 }
1000978
1001979 // ─── Two-Phase Drag Helpers ──────────────────────────────────────────────────
@@ -1076,7 +1054,7 @@ export class MediaToolbar extends BaseToolbar {
10761054 let opacity : ResolvedClip [ "opacity" ] = nextValue ;
10771055 if ( points . length > 0 ) {
10781056 const localTime = this . opacityDragTime ?? this . getOpacityTime ( clip ) ;
1079- if ( localTime === null || clip . effect || clip . transition ?. in || clip . transition ?. out ) {
1057+ if ( localTime === null ) {
10801058 this . syncOpacityState ( clip ) ;
10811059 return ;
10821060 }
@@ -1107,14 +1085,7 @@ export class MediaToolbar extends BaseToolbar {
11071085
11081086 const points = this . getOpacityPoints ( clip , clipId ) ;
11091087 const localTime = this . getOpacityTime ( clip ) ;
1110- if (
1111- points === null ||
1112- localTime === null ||
1113- this . getShotstackEdit ( ) ?. getMergeFieldForProperty ( clipId , "opacity" ) ||
1114- clip . effect ||
1115- clip . transition ?. in ||
1116- clip . transition ?. out
1117- ) {
1088+ if ( points === null || localTime === null || this . getShotstackEdit ( ) ?. getMergeFieldForProperty ( clipId , "opacity" ) ) {
11181089 this . syncOpacityState ( clip ) ;
11191090 return ;
11201091 }
@@ -1329,27 +1300,13 @@ export class MediaToolbar extends BaseToolbar {
13291300
13301301 private applyTransitionUpdate ( ) : void {
13311302 const transition = this . transitionPanel ?. getClipValue ( ) ;
1332- const clip = this . edit . getResolvedClip ( this . selectedTrackIdx , this . selectedClipIdx ) ;
1333- if ( clip && hasKeyframedVisualProperty ( clip ) ) {
1334- const changesIn = Boolean ( transition ?. in && transition . in !== clip . transition ?. in ) ;
1335- const changesOut = Boolean ( transition ?. out && transition . out !== clip . transition ?. out ) ;
1336- if ( changesIn || changesOut ) {
1337- this . transitionPanel ?. setFromClip ( clip . transition ) ;
1338- return ;
1339- }
1340- }
13411303 this . applyClipUpdate ( { transition } ) ;
13421304 }
13431305
13441306 // ─── Effect (using composite) ────────────────────────────────────────────────
13451307
13461308 private applyEffect ( ) : void {
13471309 const effectValue = this . effectPanel ?. getClipValue ( ) ;
1348- const clip = this . edit . getResolvedClip ( this . selectedTrackIdx , this . selectedClipIdx ) ;
1349- if ( effectValue && clip && hasKeyframedVisualProperty ( clip ) ) {
1350- this . effectPanel ?. setFromClip ( clip . effect ) ;
1351- return ;
1352- }
13531310 this . applyClipUpdate ( { effect : effectValue } ) ;
13541311 }
13551312
0 commit comments