mirror of
https://github.com/dnwSilver/tld.git
synced 2024-11-25 16:42:07 +00:00
🐛 Fix bug in render top level.
This commit is contained in:
parent
3a85bfbdd3
commit
a06f5c541e
@ -10,13 +10,13 @@ namespace TUI.Controls.Components;
|
|||||||
public class PanelComponent : ComponentBase, IComponent
|
public class PanelComponent : ComponentBase, IComponent
|
||||||
{
|
{
|
||||||
private readonly string _title;
|
private readonly string _title;
|
||||||
|
|
||||||
public PanelComponent(string title)
|
public PanelComponent(string title)
|
||||||
{
|
{
|
||||||
_title = title;
|
_title = title;
|
||||||
SetAbsolute();
|
SetAbsolute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderTopLine(StringBuilder builder, Size size, string title)
|
private static void RenderTopLine(StringBuilder builder, Size size, string title)
|
||||||
{
|
{
|
||||||
var halfWidth = (size.Width - title.GetWidth() - (int)Indentation.BorderWidth * 2 -
|
var halfWidth = (size.Width - title.GetWidth() - (int)Indentation.BorderWidth * 2 -
|
||||||
@ -24,15 +24,15 @@ public class PanelComponent : ComponentBase, IComponent
|
|||||||
builder.Append(Angles.LeftTop);
|
builder.Append(Angles.LeftTop);
|
||||||
builder.Append(Lines.Horizontal.Repeat(halfWidth));
|
builder.Append(Lines.Horizontal.Repeat(halfWidth));
|
||||||
builder.AppendFormat("{0}{1}{0}", Space.Repeat(Convert.ToInt32(Indentation.Default)), title);
|
builder.AppendFormat("{0}{1}{0}", Space.Repeat(Convert.ToInt32(Indentation.Default)), title);
|
||||||
builder.Append(Lines.Horizontal.Repeat(halfWidth));
|
builder.Append(Lines.Horizontal.Repeat(halfWidth + halfWidth % 2));
|
||||||
builder.Append(Angles.RightTop);
|
builder.Append(Angles.RightTop);
|
||||||
builder.Append(LineBreak);
|
builder.Append(LineBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderMiddleLine(StringBuilder builder, Size size)
|
private static void RenderMiddleLine(StringBuilder builder, Size size)
|
||||||
{
|
{
|
||||||
var dashboardHeight = size.Height - (int)Indentation.BorderWidth * 2;
|
var dashboardHeight = size.Height - (int)Indentation.BorderWidth * 2;
|
||||||
|
|
||||||
while (dashboardHeight > 0)
|
while (dashboardHeight > 0)
|
||||||
{
|
{
|
||||||
var bodyWidth = size.Width - (int)Indentation.BorderWidth * 2;
|
var bodyWidth = size.Width - (int)Indentation.BorderWidth * 2;
|
||||||
@ -40,11 +40,11 @@ public class PanelComponent : ComponentBase, IComponent
|
|||||||
builder.Append(Space.Repeat(bodyWidth));
|
builder.Append(Space.Repeat(bodyWidth));
|
||||||
builder.Append(Lines.Vertical);
|
builder.Append(Lines.Vertical);
|
||||||
builder.Append(LineBreak);
|
builder.Append(LineBreak);
|
||||||
|
|
||||||
dashboardHeight--;
|
dashboardHeight--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void RenderBottomLine(StringBuilder builder, Size size)
|
private static void RenderBottomLine(StringBuilder builder, Size size)
|
||||||
{
|
{
|
||||||
var width = size.Width - (int)Indentation.BorderWidth * 2;
|
var width = size.Width - (int)Indentation.BorderWidth * 2;
|
||||||
@ -53,15 +53,15 @@ public class PanelComponent : ComponentBase, IComponent
|
|||||||
builder.Append(Angles.RightBottom);
|
builder.Append(Angles.RightBottom);
|
||||||
builder.Append(LineBreak);
|
builder.Append(LineBreak);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Sketch DrawComponent(Size minSize)
|
protected override Sketch DrawComponent(Size minSize)
|
||||||
{
|
{
|
||||||
var builder = new StringBuilder();
|
var builder = new StringBuilder();
|
||||||
|
|
||||||
RenderTopLine(builder, minSize, _title);
|
RenderTopLine(builder, minSize, _title);
|
||||||
RenderMiddleLine(builder, minSize);
|
RenderMiddleLine(builder, minSize);
|
||||||
RenderBottomLine(builder, minSize);
|
RenderBottomLine(builder, minSize);
|
||||||
|
|
||||||
return new Sketch(builder.ToString().Main());
|
return new Sketch(builder.ToString().Main());
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,23 +10,23 @@ public class DashboardContainer : ContainerBase
|
|||||||
{
|
{
|
||||||
private readonly Nodes _children = new();
|
private readonly Nodes _children = new();
|
||||||
private readonly ContentContainer _content;
|
private readonly ContentContainer _content;
|
||||||
|
|
||||||
public DashboardContainer()
|
public DashboardContainer()
|
||||||
{
|
{
|
||||||
var panel = new PanelComponent(" ".Info() + "Dependencies".Main());
|
var panel = new PanelComponent(" ".Info() + " Dependencies".Main());
|
||||||
_content = new ContentContainer();
|
_content = new ContentContainer();
|
||||||
_content.SetOrientationVertical();
|
_content.SetOrientationVertical();
|
||||||
SetOrientationVertical();
|
SetOrientationVertical();
|
||||||
|
|
||||||
_children.Add(panel);
|
_children.Add(panel);
|
||||||
_children.Add(_content);
|
_children.Add(_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddChildren(IContainer node)
|
public void AddChildren(IContainer node)
|
||||||
{
|
{
|
||||||
node.SetFixed(Orientation.Vertical, 1);
|
node.SetFixed(Orientation.Vertical, 1);
|
||||||
_content.AddChildren(node);
|
_content.AddChildren(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Nodes GetNodes() => _children;
|
public override Nodes GetNodes() => _children;
|
||||||
}
|
}
|
@ -33,7 +33,7 @@ public class DependenciesPage : PageBase
|
|||||||
dashboard.AddChildren(projectDependencies);
|
dashboard.AddChildren(projectDependencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
var breadCrumbs = new BreadCrumbsComponent(" dependencies", "JavaScript");
|
var breadCrumbs = new BreadCrumbsComponent(" Dependencies", "JavaScript");
|
||||||
var footer = new FooterContainer(breadCrumbs);
|
var footer = new FooterContainer(breadCrumbs);
|
||||||
var layout = new DashboardLayout(header, dashboard, footer);
|
var layout = new DashboardLayout(header, dashboard, footer);
|
||||||
canvas.Draw(layout);
|
canvas.Draw(layout);
|
||||||
|
@ -8,11 +8,10 @@ Console.CursorVisible = false;
|
|||||||
|
|
||||||
var welcomePage = new WelcomePage();
|
var welcomePage = new WelcomePage();
|
||||||
welcomePage.Open();
|
welcomePage.Open();
|
||||||
Thread.Sleep(2000);
|
Thread.Sleep(500);
|
||||||
|
|
||||||
var dependenciesPage = new DependenciesPage();
|
var dependenciesPage = new DependenciesPage();
|
||||||
dependenciesPage.Open();
|
dependenciesPage.Open();
|
||||||
// display.OpenDeps(settings.Projects[0]);
|
|
||||||
|
|
||||||
var key = new ConsoleKeyInfo('1', ConsoleKey.NoName, false, false, false);
|
var key = new ConsoleKeyInfo('1', ConsoleKey.NoName, false, false, false);
|
||||||
var waitCommand = true;
|
var waitCommand = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user