Keyframes - Copy/paste WIP

Timeline - Improved sizing, avoid unnecessary scrolling
Timeline - Fix selection rectangle appearing on mousedown
This commit is contained in:
Robert committed 2020-12-02 19:11:39 +01:00
1 parent 7c955d1134
commit f110383ed4
18 files changed
+381 -122

No files matched your search

@@ -0,0 +1,36 @@
using System;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core
{
/// <summary>
/// Represents a keyframe on a <see cref="ILayerProperty" /> containing a value and a timestamp
/// </summary>
public interface ILayerPropertyKeyframe
{
/// <summary>
/// Gets an untyped reference to the layer property of this keyframe
/// </summary>
ILayerProperty UntypedLayerProperty { get; }
/// <summary>
/// The position of this keyframe in the timeline
/// </summary>
TimeSpan Position { get; set; }
/// <summary>
/// The easing function applied on the value of the keyframe
/// </summary>
Easings.Functions EasingFunction { get; set; }
/// <summary>
/// Gets the entity this keyframe uses for persistent storage
/// </summary>
KeyframeEntity GetKeyframeEntity();
/// <summary>
/// Removes the keyframe from the layer property
/// </summary>
void Remove();
}
}
@@ -559,12 +559,7 @@ namespace Artemis.Core
Entity.Value = CoreJson.SerializeObject(BaseValue);
Entity.KeyframesEnabled = KeyframesEnabled;
Entity.KeyframeEntities.Clear();
Entity.KeyframeEntities.AddRange(Keyframes.Select(k => new KeyframeEntity
{
Value = CoreJson.SerializeObject(k.Value),
Position = k.Position,
EasingFunction = (int) k.EasingFunction
}));
Entity.KeyframeEntities.AddRange(Keyframes.Select(k => k.GetKeyframeEntity()));
Entity.DataBindingEntities.Clear();
foreach (IDataBinding dataBinding in _dataBindings)
@@ -1,11 +1,12 @@
using System;
using Artemis.Storage.Entities.Profile;
namespace Artemis.Core
{
/// <summary>
/// Represents a keyframe on a <see cref="LayerProperty{T}" /> containing a value and a timestamp
/// </summary>
public class LayerPropertyKeyframe<T> : CorePropertyChanged
public class LayerPropertyKeyframe<T> : CorePropertyChanged, ILayerPropertyKeyframe
{
private LayerProperty<T> _layerProperty;
private TimeSpan _position;
@@ -45,10 +46,10 @@ namespace Artemis.Core
set => SetAndNotify(ref _value, value);
}
/// <summary>
/// The position of this keyframe in the timeline
/// </summary>
/// <inheritdoc />
public ILayerProperty UntypedLayerProperty => LayerProperty;
/// <inheritdoc />
public TimeSpan Position
{
get => _position;
@@ -59,14 +60,21 @@ namespace Artemis.Core
}
}
/// <summary>
/// The easing function applied on the value of the keyframe
/// </summary>
/// <inheritdoc />
public Easings.Functions EasingFunction { get; set; }
/// <summary>
/// Removes the keyframe from the layer property
/// </summary>
/// <inheritdoc />
public KeyframeEntity GetKeyframeEntity()
{
return new KeyframeEntity
{
Value = CoreJson.SerializeObject(Value),
Position = Position,
EasingFunction = (int) EasingFunction
};
}
/// <inheritdoc />
public void Remove()
{
LayerProperty.RemoveKeyframe(this);