A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

51 lines
1.5 KiB

using System.Collections.Generic;
using Avalonia.Rendering.Composition.Expressions;
// Special license applies <see href="https://raw.githubusercontent.com/AvaloniaUI/Avalonia/master/src/Avalonia.Base/Rendering/Composition/License.md">License.md</see>
namespace Avalonia.Rendering.Composition.Animations
{
/// <summary>
/// A snapshot of properties used by an animation
/// </summary>
internal class PropertySetSnapshot : IExpressionParameterCollection, IExpressionObject
{
private readonly Dictionary<string, Value> _dic;
public struct Value
{
public ExpressionVariant Variant;
public IExpressionObject Object;
public Value(IExpressionObject o)
{
Object = o;
Variant = default;
}
public static implicit operator Value(ExpressionVariant v) => new Value
{
Variant = v
};
}
public PropertySetSnapshot(Dictionary<string, Value> dic)
{
_dic = dic;
}
public ExpressionVariant GetParameter(string name)
{
_dic.TryGetValue(name, out var v);
return v.Variant;
}
public IExpressionObject GetObjectParameter(string name)
{
_dic.TryGetValue(name, out var v);
return v.Object;
}
public ExpressionVariant GetProperty(string name) => GetParameter(name);
}
}