Skip to content

Commit

Permalink
feat: Adjust keyframe positions for the latter elements after splitti…
Browse files Browse the repository at this point in the history
…ng (#1131)
  • Loading branch information
yuto-trd authored Oct 23, 2024
1 parent 7b50236 commit 933831e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Beutl/ViewModels/ElementViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Avalonia;
using Avalonia.Input;
using Avalonia.Input.Platform;
using Beutl.Animation;
using Beutl.Commands;
using Beutl.Helpers;
using Beutl.Models;
Expand Down Expand Up @@ -360,6 +361,16 @@ private void OnSplit(TimeSpan timeSpan)
IRecordableCommand command1 = Scene.MoveChild(Model.ZIndex, Model.Start, forwardLength, Model);
backward.Start = absTime;
backward.Length = backwardLength;
foreach (KeyFrameAnimation item in new ObjectSearcher(backward,
o => o is KeyFrameAnimation { UseGlobalClock: false })
.SearchAll()
.OfType<KeyFrameAnimation>())
{
foreach (IKeyFrame keyframe in item.KeyFrames)
{
keyframe.KeyTime -= forwardLength;
}
}

backward.Save(RandomFileNameGenerator.Generate(Path.GetDirectoryName(Scene.FileName)!,
Constants.ElementFileExtension));
Expand Down

0 comments on commit 933831e

Please sign in to comment.