From 00a06a093f62527e638853c360733415624381a3 Mon Sep 17 00:00:00 2001 From: Chetan-Gudagamanal Date: Thu, 7 Dec 2023 09:54:20 +0530 Subject: [PATCH] cl-575 fix for last subtitle holding on to the mouse click issue --- .../Video/components/SubtitleBoxes.jsx | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/containers/Organization/Video/components/SubtitleBoxes.jsx b/src/containers/Organization/Video/components/SubtitleBoxes.jsx index b5ab4953..0287ded8 100644 --- a/src/containers/Organization/Video/components/SubtitleBoxes.jsx +++ b/src/containers/Organization/Video/components/SubtitleBoxes.jsx @@ -184,7 +184,7 @@ export default memo( const nextCardStartTime = endTime; const previousCardEndTime = startTime; const width = (endTime - startTime) * 10 * gridGap; - const nextCardWidth = (next.endTime - nextCardStartTime) * 10 * gridGap; + const nextCardWidth = (next?next.endTime:(nextCardStartTime+10) - nextCardStartTime) * 10 * gridGap; const previousCardWidth = (previousCardEndTime - previou?.startTime?previou.startTime:0) * 10 * gridGap; @@ -197,9 +197,11 @@ export default memo( } if(index > 0 && startTime < DT.t2d(previou.end_time) && startTime !== DT.t2d(previou.end_time)) { - updateSub(lastSub, { start_time }); - updateSub(previou, { end_time: start_time }); - previousTarget.style.width = `${previousCardWidth}px`; + if (index!==1){ + updateSub(lastSub, { start_time }); + updateSub(previou, { end_time: start_time }); + previousTarget.style.width = `${previousCardWidth}px`; + } } if (index === 0) { @@ -231,9 +233,10 @@ export default memo( nextTarget.style.width = `${nextCardWidth}px`; } - if (index === subtitles.length - 1 && endTime < lastSub.endTime) { - updateSub(lastSub, { end_time }); - } + // //allow last subtitle endtime edit + // if (index === subtitles.length - 1) { + // updateSub(lastSub, { end_time }); + // } } else { lastTarget.style.width = `${width}px`; }