Column: added content direction support

This commit is contained in:
MarcinZiabek
2022-10-19 20:04:31 +02:00
parent e6e6febf8b
commit 9770575f9a
+9 -3
View File
@@ -19,8 +19,10 @@ namespace QuestPDF.Elements
public Position Offset { get; set; }
}
internal class Column : Element, ICacheable, IStateResettable
internal class Column : Element, ICacheable, IStateResettable, IContentDirectionAware
{
public ContentDirection ContentDirection { get; set; }
internal List<ColumnItem> Items { get; } = new();
internal float Spacing { get; set; }
@@ -75,9 +77,13 @@ namespace QuestPDF.Elements
var targetSize = new Size(availableSpace.Width, command.Size.Height);
Canvas.Translate(command.Offset);
var offset = ContentDirection == ContentDirection.LeftToRight
? command.Offset
: new Position(availableSpace.Width - command.Offset.X - command.Measurement.Width, command.Offset.Y);
Canvas.Translate(offset);
command.ColumnItem.Draw(targetSize);
Canvas.Translate(command.Offset.Reverse());
Canvas.Translate(offset.Reverse());
}
if (Items.All(x => x.IsRendered))