Fix layout on wires UI (#33714)

Layout would break for machines with >6 lights because the column count was hardcoded. Uncap the UI width and fix the rows count instead.

Lights with less than 4 characters of text weren't aligned right, now they are.
This commit is contained in:
Pieter-Jan Briers
2024-12-04 11:13:22 +01:00
committed by GitHub
parent 7ffd8012f6
commit c10a72be39

View File

@@ -206,8 +206,7 @@ namespace Content.Client.Wires.UI
(_statusContainer = new GridContainer (_statusContainer = new GridContainer
{ {
Margin = new Thickness(8, 4), Margin = new Thickness(8, 4),
// TODO: automatically change columns count. Rows = 2
Columns = 3
}) })
} }
} }
@@ -227,7 +226,8 @@ namespace Content.Client.Wires.UI
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")} PanelOverride = new StyleBoxFlat {BackgroundColor = Color.FromHex("#525252ff")}
}); });
CloseButton.OnPressed += _ => Close(); CloseButton.OnPressed += _ => Close();
SetSize = new Vector2(320, 200); SetHeight = 200;
MinWidth = 320;
} }
@@ -503,6 +503,8 @@ namespace Content.Client.Wires.UI
public StatusLight(StatusLightData data, IResourceCache resourceCache) public StatusLight(StatusLightData data, IResourceCache resourceCache)
{ {
HorizontalAlignment = HAlignment.Right;
var hsv = Color.ToHsv(data.Color); var hsv = Color.ToHsv(data.Color);
hsv.Z /= 2; hsv.Z /= 2;
var dimColor = Color.FromHsv(hsv); var dimColor = Color.FromHsv(hsv);