ConsoleUI container size text
This commit is contained in:
@@ -214,7 +214,6 @@ public sealed class Grid<T> : ChildContainerView<Grid<T>, T>, IVisibilityChangeH
|
||||
int row,
|
||||
IReadOnlyList<IView> forceRerenderChildren)
|
||||
{
|
||||
if (!viewsByPosition.TryGetValue((column, row), out var children)) return false;
|
||||
|
||||
var width = columnWidths[column];
|
||||
var height = rowHeights[row];
|
||||
@@ -239,6 +238,12 @@ public sealed class Grid<T> : ChildContainerView<Grid<T>, T>, IVisibilityChangeH
|
||||
}
|
||||
|
||||
if (renderSize.Width == 0 || renderSize.Height == 0) return false;
|
||||
|
||||
if (!viewsByPosition.TryGetValue((column, row), out var children))
|
||||
{
|
||||
RenderEmpty(context, renderPosition, renderSize);
|
||||
return true;
|
||||
}
|
||||
|
||||
var needsRerender = children.Any(forceRerenderChildren.Contains);
|
||||
if (needsRerender)
|
||||
@@ -270,7 +275,7 @@ public sealed class Grid<T> : ChildContainerView<Grid<T>, T>, IVisibilityChangeH
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return needsRerender;
|
||||
|
||||
static Position GetRenderPosition(
|
||||
Position gridPosition,
|
||||
|
||||
@@ -99,6 +99,35 @@ public sealed partial class StackPanel<T> : ChildContainerView<StackPanel<T>, T>
|
||||
: childSize.Width;
|
||||
}
|
||||
|
||||
if (Orientation == Orientation.Horizontal)
|
||||
{
|
||||
var leftWidth = size.Width - delta;
|
||||
Span<char> text = stackalloc char[leftWidth];
|
||||
text.Fill(ApplicationContext!.EmptyCharacter);
|
||||
|
||||
SetColorsForDriver(renderContext);
|
||||
RenderText(
|
||||
text,
|
||||
renderContext.ConsoleDriver,
|
||||
position with {X = position.X + delta},
|
||||
size with {Width = leftWidth}
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
var leftHeight = size.Height - delta;
|
||||
Span<char> text = stackalloc char[size.Width];
|
||||
text.Fill(ApplicationContext!.EmptyCharacter);
|
||||
|
||||
SetColorsForDriver(renderContext);
|
||||
RenderText(
|
||||
text,
|
||||
renderContext.ConsoleDriver,
|
||||
position with {Y = position.Y + delta},
|
||||
size with {Height = leftHeight}
|
||||
);
|
||||
}
|
||||
|
||||
return neededRerender;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user