Files
QuestPDF/QuestPDF/Infrastructure/ContainerElement.cs
T
2021-05-02 14:40:08 +02:00

26 lines
688 B
C#

using QuestPDF.Drawing.SpacePlan;
using QuestPDF.Elements;
namespace QuestPDF.Infrastructure
{
internal abstract class ContainerElement : Element, IContainer
{
internal Element? Child { get; set; } = Empty.Instance;
IElement? IContainer.Child
{
get => Child;
set => Child = value as Element;
}
internal override ISpacePlan Measure(Size availableSpace)
{
return Child?.Measure(availableSpace) ?? new FullRender(Size.Zero);
}
internal override void Draw(ICanvas canvas, Size availableSpace)
{
Child?.Draw(canvas, availableSpace);
}
}
}