@@ -158,26 +158,22 @@ export const SourceLayerItem = (props: Readonly<ISourceLayerItemProps>): JSX.Ele
158158 // this.props.onFollowLiveLine?.(false, e)
159159 e . preventDefault ( )
160160 e . stopPropagation ( )
161- onClick ?. ( piece , e )
161+ onClick && onClick ( piece , e )
162162 } ,
163163 [ piece ]
164164 )
165165 const itemDblClick = useCallback (
166166 ( e : React . MouseEvent < HTMLDivElement > ) => {
167+ e . preventDefault ( )
168+ e . stopPropagation ( )
169+
167170 if ( studio ?. settings . enableUserEdits && ! studio ?. settings . allowPieceDirectPlay ) {
168171 const pieceId = piece . instance . piece . _id
169172 if ( ! selectElementContext . isSelected ( pieceId ) ) {
170173 selectElementContext . clearAndSetSelection ( { type : 'piece' , elementId : pieceId } )
171174 } else {
172175 selectElementContext . clearSelections ( )
173176 }
174- // Until a proper data structure, the only reference is a part.
175- // const partId = this.props.part.instance.part._id
176- // if (!selectElementContext.isSelected(partId)) {
177- // selectElementContext.clearAndSetSelection({ type: 'part', elementId: partId })
178- // } else {
179- // selectElementContext.clearSelections()
180- // }
181177 } else if ( typeof onDoubleClick === 'function' ) {
182178 onDoubleClick ( piece , e )
183179 }
@@ -276,6 +272,7 @@ export const SourceLayerItem = (props: Readonly<ISourceLayerItemProps>): JSX.Ele
276272 clientY : e . clientY ,
277273 }
278274 } , [ ] )
275+ const selectElementContext = useSelectedElementsContext ( )
279276
280277 const convertTimeToPixels = ( time : number ) => {
281278 return Math . round ( timeScale * time )
@@ -522,6 +519,7 @@ export const SourceLayerItem = (props: Readonly<ISourceLayerItemProps>): JSX.Ele
522519
523520 const renderInsideItem = ( typeClass : string ) => {
524521 const elProps = {
522+ key : unprotectString ( piece . instance . _id ) ,
525523 typeClass : typeClass ,
526524 getItemDuration : getItemDuration ,
527525 getItemLabelOffsetLeft : getItemLabelOffsetLeft ,
@@ -535,25 +533,25 @@ export const SourceLayerItem = (props: Readonly<ISourceLayerItemProps>): JSX.Ele
535533 switch ( layer . type ) {
536534 case SourceLayerType . SCRIPT :
537535 // case SourceLayerType.MIC:
538- return < MicSourceRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
536+ return < MicSourceRenderer { ...elProps } />
539537 case SourceLayerType . VT :
540538 case SourceLayerType . LIVE_SPEAK :
541- return < VTSourceRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
539+ return < VTSourceRenderer { ...elProps } />
542540 case SourceLayerType . GRAPHICS :
543541 case SourceLayerType . LOWER_THIRD :
544542 case SourceLayerType . STUDIO_SCREEN :
545- return < L3rdSourceRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
543+ return < L3rdSourceRenderer { ...elProps } />
546544 case SourceLayerType . SPLITS :
547- return < SplitsSourceRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
545+ return < SplitsSourceRenderer { ...elProps } />
548546
549547 case SourceLayerType . TRANSITION :
550548 // TODOSYNC: TV2 uses other renderers, to be discussed.
551549
552- return < TransitionSourceRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
550+ return < TransitionSourceRenderer { ...elProps } />
553551 case SourceLayerType . LOCAL :
554- return < LocalLayerItemRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
552+ return < LocalLayerItemRenderer { ...elProps } />
555553 default :
556- return < DefaultLayerItemRenderer key = { unprotectString ( piece . instance . _id ) } { ...elProps } />
554+ return < DefaultLayerItemRenderer { ...elProps } />
557555 }
558556 }
559557
0 commit comments