Update paragraph end time in KaraokeEffect class

Moved the procedure of setting the end time of the last paragraph from the EffectKaraoke form to the KaraokeEffect class. This change ensures that the proper end time for each animation is set directly within the class where they are created, promoting better code organization.
This commit is contained in:
Ivandro Jao 2024-03-31 11:40:45 +01:00
parent 9cc215b77d
commit 396adfb1a9
2 changed files with 5 additions and 6 deletions

View File

@ -32,6 +32,11 @@ namespace Nikse.SubtitleEdit.Core.Common.TextEffect
animations.Add(new Paragraph(startTime, endTime, result[i]));
}
if (animations.Count > 0)
{
animations[animations.Count - 1].EndTime.TotalMilliseconds = paragraph.EndTime.TotalMilliseconds;
}
return animations;
}

View File

@ -120,12 +120,6 @@ namespace Nikse.SubtitleEdit.Forms
var delaySeconds = (double)numericUpDownDelay.Value;
var karaokeEffect = new KaraokeEffect(SelectStrategy());
_animation.AddRange(karaokeEffect.Transform(_paragraph, panelColor.BackColor, delaySeconds * TimeCode.BaseUnit));
// All remaining time should go to the last paragraph.
if (_animation.Count > 0)
{
_animation[_animation.Count - 1].EndTime.TotalMilliseconds = _paragraph.EndTime.TotalMilliseconds;
}
}
private TextEffectBase SelectStrategy()