Code/UI/SmartRoot.cs
namespace Nodebox.UI;
[Title("Nodebox Smart Root Root")]
public sealed class SmartRoot : PanelComponent, IGraphStyle {
[Property]
public GraphStyle GraphStyle { get; set; }
[Property]
[Change(nameof(Recreate))]
public SerializableType PanelType { get; set; } = null;
public Panel ChildPanel { get; private set; } = null;
[JsonIgnore]
public Dictionary<string, object> Properties = [];
protected override void OnTreeFirstBuilt() {
base.OnTreeFirstBuilt();
Recreate();
}
private void Recreate() {
if (!Panel.IsValid()) { return; }
if (PanelType?.Type == null) { return; }
ChildPanel = PanelType.Create<Panel>();
ChildPanel.Parent = Panel;
}
// protected override int BuildHash() => HashCode.Combine(
// // GraphStyle,
// );
}