Windows 0.3.5 traffic trends UI source delta; connection fixes retained; no private history or other platform changes
This commit is contained in:
+17
-16
@@ -6,8 +6,8 @@ internal readonly record struct DashboardGeometry(
|
||||
Rectangle[] Metrics, Rectangle TrafficCard, Rectangle TailnetTrafficCard, Rectangle SpeedTrendCard, Rectangle DailyCard, Rectangle ServerTrafficCard, Rectangle Footer,
|
||||
int ContentHeight, bool Compact, float VerticalScale);
|
||||
|
||||
// All measurements are logical pixels converted exactly once. Every data row
|
||||
// spans the canvas; the optional transport row borrows height from the plot.
|
||||
// One fitted page: local proxy trend, per-server trends, then numeric totals.
|
||||
// Transport selection changes the local chart caption, never the page geometry.
|
||||
internal static class DashboardLayout
|
||||
{
|
||||
internal static DashboardGeometry Calculate(Size viewport, int dpi, bool showTailnet = false, bool showServerTraffic = false, bool preferCompact = false)
|
||||
@@ -27,16 +27,18 @@ internal static class DashboardLayout
|
||||
// The right hand actual-state panel is embedded in the same surface.
|
||||
var actualLeft = width / 2 + S(4);
|
||||
var actual = new Rectangle(actualLeft, 0, width - actualLeft - S(8), configuration.Height);
|
||||
var traffic = new Rectangle(margin, configuration.Bottom + gap, width, S(24));
|
||||
var tailnet = showTailnet ? new Rectangle(margin, traffic.Bottom + gap, width, S(24)) : Rectangle.Empty;
|
||||
var daily = new Rectangle(margin, (showTailnet ? tailnet.Bottom : traffic.Bottom) + gap, width, S(22));
|
||||
var traffic = Rectangle.Empty;
|
||||
var tailnet = Rectangle.Empty;
|
||||
var footer = new Rectangle(margin, viewport.Height - margin - S(18), width, S(18));
|
||||
var servers = showServerTraffic ? new Rectangle(margin, footer.Top - gap - S(38), width, S(38)) : Rectangle.Empty;
|
||||
var trendTop = daily.Bottom + gap;
|
||||
var trend = new Rectangle(margin, trendTop, width, Math.Max(S(28), (showServerTraffic ? servers.Top : footer.Top) - gap - trendTop));
|
||||
var daily = new Rectangle(margin, footer.Top - gap - S(22), width, S(22));
|
||||
var trendTop = configuration.Bottom + gap;
|
||||
var graphHeight = Math.Max(S(72), daily.Top - gap - trendTop);
|
||||
var serverHeight = showServerTraffic ? Math.Min(S(100), (int)Math.Round((graphHeight-gap)*.52)) : 0;
|
||||
var trend = new Rectangle(margin, trendTop, width, graphHeight - (showServerTraffic ? serverHeight+gap : 0));
|
||||
var servers = showServerTraffic ? new Rectangle(margin, trend.Bottom+gap, width, serverHeight) : Rectangle.Empty;
|
||||
var headingWidth = S(120);
|
||||
var speedWidth = (width - headingWidth - S(10)) / 2;
|
||||
Rectangle Speed(int column) => new(headingWidth + column * speedWidth, 0, speedWidth, traffic.Height - S(2));
|
||||
Rectangle Speed(int column) => new(headingWidth + column * speedWidth, 0, speedWidth, S(22));
|
||||
Rectangle Total(int column) => new(headingWidth + column * speedWidth, 0, speedWidth, daily.Height - S(2));
|
||||
Rectangle[] metrics = [Total(0), Speed(0), Speed(1), Total(1)];
|
||||
return new(welcome, account, identity, logout, status, configuration, actual, metrics,
|
||||
@@ -53,8 +55,7 @@ internal static class DashboardLayout
|
||||
{
|
||||
var viewport = new Size(width * dpi / 96, height * dpi / 96);
|
||||
var p = Calculate(viewport, dpi, showTailnet, showServers);
|
||||
Rectangle[] cards = [p.StatusCard,p.NodeCard,p.TrafficCard,p.SpeedTrendCard,p.DailyCard,p.Footer];
|
||||
if(showTailnet)cards=[..cards,p.TailnetTrafficCard];
|
||||
Rectangle[] cards = [p.StatusCard,p.NodeCard,p.SpeedTrendCard,p.DailyCard,p.Footer];
|
||||
if(showServers)cards=[..cards,p.ServerTrafficCard];
|
||||
if (cards.Any(c => c.Left < 0 || c.Right > viewport.Width || c.Bottom > p.ContentHeight || c.Width <= 0 || c.Height<=0)) return false;
|
||||
for (var i = 0; i < cards.Length; i++)
|
||||
@@ -65,19 +66,19 @@ internal static class DashboardLayout
|
||||
if (p.Metrics[0].IntersectsWith(p.Metrics[3]) || p.Metrics[1].IntersectsWith(p.Metrics[2])) return false;
|
||||
for (var i = 0; i < p.Metrics.Length; i++)
|
||||
{
|
||||
var parent=i==0||i==3?p.DailyCard:p.TrafficCard;
|
||||
var parent=p.DailyCard;
|
||||
if(!new Rectangle(Point.Empty,parent.Size).Contains(p.Metrics[i]))return false;
|
||||
}
|
||||
if (!showTailnet && p.TailnetTrafficCard != Rectangle.Empty) return false;
|
||||
if (p.TrafficCard != Rectangle.Empty || p.TailnetTrafficCard != Rectangle.Empty) return false;
|
||||
if (p.ContentHeight > viewport.Height || p.Footer.Bottom > viewport.Height) return false;
|
||||
var baseline = Calculate(viewport, dpi, false, showServers);
|
||||
if (p.Footer != baseline.Footer || p.ContentHeight != baseline.ContentHeight || p.TrafficCard != baseline.TrafficCard) return false;
|
||||
if (showTailnet && (p.TailnetTrafficCard.Top <= p.TrafficCard.Bottom || p.DailyCard.Top<=p.TailnetTrafficCard.Bottom)) return false;
|
||||
if(p.TrafficCard.Width!=p.SpeedTrendCard.Width || p.DailyCard.Height>Sized(40))return false;
|
||||
if(p.SpeedTrendCard.Width!=p.DailyCard.Width || p.DailyCard.Height>Sized(24))return false;
|
||||
if (p.Metrics[0].Left != p.Metrics[1].Left || p.Metrics[3].Left != p.Metrics[2].Left
|
||||
|| p.Metrics[0].Width != p.Metrics[1].Width || p.Metrics[3].Width != p.Metrics[2].Width) return false;
|
||||
if(p.SpeedTrendCard.Height<Sized(45))return false;
|
||||
if (showServers && (p.ServerTrafficCard.Top <= p.SpeedTrendCard.Bottom || p.ServerTrafficCard.Bottom >= p.Footer.Top)) return false;
|
||||
if (p.SpeedTrendCard.Top <= p.NodeCard.Bottom || p.DailyCard.Top<=p.SpeedTrendCard.Bottom) return false;
|
||||
if (showServers && (p.ServerTrafficCard.Top <= p.SpeedTrendCard.Bottom || p.ServerTrafficCard.Bottom >= p.DailyCard.Top)) return false;
|
||||
int Sized(int n)=>(int)Math.Round(n*Math.Max(1f,dpi/96f));
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user