Skip to content

Commit

Permalink
Merge pull request #515 from AI4Bharat/cl-575-last-sub-drag-issue-fix
Browse files Browse the repository at this point in the history
cl-575 fix for last subtitle holding on to the mouse click issue
  • Loading branch information
AlpanaMajhi authored Dec 8, 2023
2 parents cdd4cb5 + 00a06a0 commit e927c99
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/containers/Organization/Video/components/SubtitleBoxes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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) {
Expand Down Expand Up @@ -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`;
}
Expand Down

0 comments on commit e927c99

Please sign in to comment.