mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-28 23:12:34 +01:00
Make sure previous shot change fallback value is far away enough from zero
This commit is contained in:
parent
775ea9cb8d
commit
05ba89cdda
@ -166,7 +166,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
{
|
||||
// Cues want to be pushed together. The connect subtitles are most likely between two shot changes that are close together
|
||||
// For now, check which shot change is closer and align the cues around that, ignoring the zones
|
||||
var previousShotChange = new List<int> { -1 }.Concat(_shotChangesFrames).Last(x => x <= newLeftOutCueFrame); // will return -1 if none found
|
||||
var previousShotChange = new List<int> { int.MinValue }.Concat(_shotChangesFrames).Last(x => x <= newLeftOutCueFrame); // will return minValue if none found
|
||||
var nextShotChange = _shotChangesFrames.Concat(new List<int> { int.MaxValue }).First(x => x >= newRightInCueFrame); // will return maxValue if none found
|
||||
if (previousShotChange >= 0 && nextShotChange != int.MaxValue)
|
||||
{
|
||||
@ -255,7 +255,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
|
||||
private (int cueFrame, FindBestCueResult result) FindConnectedSubtitlesBestCueFrame(int cueFrame)
|
||||
{
|
||||
var previousShotChange = new List<int> { -1 }.Concat(_shotChangesFrames).Last(x => x <= cueFrame); // will return -1 if none found
|
||||
var previousShotChange = new List<int> { int.MinValue }.Concat(_shotChangesFrames).Last(x => x <= cueFrame); // will return minValue if none found
|
||||
var nextShotChange = _shotChangesFrames.Concat(new List<int> { int.MaxValue }).First(x => x >= cueFrame); // will return maxValue if none found
|
||||
|
||||
// If both not found, return self
|
||||
@ -683,7 +683,7 @@ namespace Nikse.SubtitleEdit.Core.Forms
|
||||
|
||||
private (int cueFrame, FindBestCueResult result) FindBestCueFrame(int cueFrame, bool isInCue)
|
||||
{
|
||||
var previousShotChange = new List<int> { -1 }.Concat(_shotChangesFrames).Last(x => x <= cueFrame); // will return -1 if none found
|
||||
var previousShotChange = new List<int> { int.MinValue }.Concat(_shotChangesFrames).Last(x => x <= cueFrame); // will return minValue if none found
|
||||
var nextShotChange = _shotChangesFrames.Concat(new List<int> { int.MaxValue }).First(x => x >= cueFrame); // will return maxValue if none found
|
||||
|
||||
// If both not found, return self
|
||||
|
Loading…
Reference in New Issue
Block a user