CssPerspectiveProperty
More information available at:
https://developer.mozilla.org/en-US/docs/Web/CSS/perspective
using AngleSharp.Css;
using AngleSharp.Extensions;
namespace AngleSharp.Dom.Css
{
internal sealed class CssPerspectiveProperty : CssProperty, ICssPerspectiveProperty, ICssProperty
{
internal static readonly Length Default = Length.Zero;
internal static readonly IValueConverter<Length> Converter = Converters.LengthConverter.Or(Keywords.None, Default);
private Length _distance;
public Length Distance => _distance;
internal CssPerspectiveProperty(CssStyleDeclaration rule)
: base(PropertyNames.Perspective, rule, PropertyFlags.Animatable)
{
Reset();
}
public void SetDistance(Length distance)
{
_distance = distance;
}
internal override void Reset()
{
_distance = Default;
}
protected override bool IsValid(ICssValue value)
{
return Converter.TryConvert(value, SetDistance);
}
}
}