Profiles - Abstracted property elements and effect elements

Folders - Added properties to folders
Layer effects - Expanded to folders
Layer effects - Added shape clipping
This commit is contained in:
SpoinkyNL committed 2020-06-17 19:21:23 +02:00
1 parent 1a637f7f95
commit 9f778d840f
42 files changed
+638 -347

No files matched your search

@@ -0,0 +1,54 @@
using System.Collections.Generic;
using Artemis.Storage.Entities.Profile;
using SkiaSharp;
namespace Artemis.Core.Models.Profile
{
public abstract class PropertiesProfileElement : ProfileElement
{
internal abstract PropertiesEntity PropertiesEntity { get; }
private SKPath _path;
/// <summary>
/// Gets a copy of the path containing all the LEDs this entity is applied to, any rendering outside the entity Path is
/// clipped.
/// </summary>
public SKPath Path
{
get => _path != null ? new SKPath(_path) : null;
protected set
{
_path = value;
// I can't really be sure about the performance impact of calling Bounds often but
// SkiaSharp calls SkiaApi.sk_path_get_bounds (Handle, &rect); which sounds expensive
Bounds = value?.Bounds ?? SKRect.Empty;
}
}
/// <summary>
/// The bounds of this entity
/// </summary>
public SKRect Bounds { get; private set; }
#region Property group expansion
protected List<string> _expandedPropertyGroups;
public bool IsPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup)
{
return _expandedPropertyGroups.Contains(layerPropertyGroup.Path);
}
public void SetPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup, bool expanded)
{
if (!expanded && IsPropertyGroupExpanded(layerPropertyGroup))
_expandedPropertyGroups.Remove(layerPropertyGroup.Path);
else if (expanded && !IsPropertyGroupExpanded(layerPropertyGroup))
_expandedPropertyGroups.Add(layerPropertyGroup.Path);
}
#endregion
}
}