@@ -23,9 +23,16 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
-
- <ToggleButton Content="Play" Name="PART_PlayToggle"/>
+
+ <DockPanel Grid.Row="0" LastChildFill="True">
+ <Button DockPanel.Dock="Left" Classes="pixi-icon"
+ Content="{DynamicResource icon-plus-square}"
+ Command="{TemplateBinding NewKeyFrameCommand}"/>
+ <Panel>
+ <ToggleButton HorizontalAlignment="Center" Content="Play" Name="PART_PlayToggle"/>
+ </Panel>
+ </DockPanel>
<DockPanel Grid.Row="1" LastChildFill="True">
<Slider Margin="10 0" TickFrequency="1" TickPlacement="BottomRight"
SmallChange="1"
@@ -10,7 +10,7 @@ internal class AnimationsViewModel : SubViewModel<ViewModelMain>
}
- [Command.Debug("PixiEditor.Animations.CreateRasterClip", "Create Raster Clip", "Create a raster clip")]
+ [Command.Basic("PixiEditor.Animation.CreateRasterKeyFrame", "Create Raster Key Frame", "Create a raster key frame")]
public void CreateRasterClip()
{
var activeDocument = Owner.DocumentManagerSubViewModel.ActiveDocument;
@@ -25,6 +25,16 @@ public class Timeline : TemplatedControl
public static readonly StyledProperty<bool> IsPlayingProperty = AvaloniaProperty.Register<Timeline, bool>(
nameof(IsPlaying));
+ public static readonly StyledProperty<ICommand> NewKeyFrameCommandProperty =
+ AvaloniaProperty.Register<Timeline, ICommand>(
+ nameof(NewKeyFrameCommand));
+ public ICommand NewKeyFrameCommand
+ {
+ get => GetValue(NewKeyFrameCommandProperty);
+ set => SetValue(NewKeyFrameCommandProperty, value);
+ }
public bool IsPlaying
get => GetValue(IsPlayingProperty);
@@ -14,5 +14,6 @@
</Design.DataContext>
<animations:Timeline
KeyFrames="{Binding DocumentManagerSubViewModel.ActiveDocument.AnimationDataViewModel.KeyFrames}"
- ActiveFrame="{Binding DocumentManagerSubViewModel.ActiveDocument.AnimationDataViewModel.ActiveFrameBindable, Mode=TwoWay}"/>
+ ActiveFrame="{Binding DocumentManagerSubViewModel.ActiveDocument.AnimationDataViewModel.ActiveFrameBindable, Mode=TwoWay}"
+ NewKeyFrameCommand="{xaml:Command PixiEditor.Animation.CreateRasterKeyFrame}"/>
</UserControl>
@@ -33,7 +33,7 @@ internal class ActiveFrame_UpdateableChange : UpdateableChange
public override OneOf<None, IChangeInfo, List<IChangeInfo>> Apply(Document target, bool firstApply, out bool ignoreInUndo)
- ignoreInUndo = originalFrame == newFrame;
+ ignoreInUndo = true;
target.AnimationData.ActiveFrame = newFrame;
return new ActiveFrame_ChangeInfo(newFrame);