Make StyleBoxTexture respect UI zoom level (#4165)

This commit is contained in:
eoineoineoin
2023-07-08 19:49:25 +01:00
committed by GitHub
parent 591c261ff5
commit bbf8827efd
14 changed files with 85 additions and 80 deletions

View File

@@ -143,7 +143,7 @@ namespace Robust.Client.UserInterface.Controls
var panel = _getPanel();
var panelBox = new UIBox2(0, headerSize, PixelWidth, PixelHeight);
panel?.Draw(handle, panelBox);
panel?.Draw(handle, panelBox, UIScale);
var font = _getFont();
var boxActive = _getTabBoxActive();
@@ -185,10 +185,10 @@ namespace Robust.Client.UserInterface.Controls
if (box != null)
{
var drawBox = box.GetEnvelopBox(topLeft, size);
var drawBox = box.GetEnvelopBox(topLeft, size, UIScale);
boxAdvance = drawBox.Width;
box.Draw(handle, drawBox);
contentBox = box.GetContentBox(drawBox);
box.Draw(handle, drawBox, UIScale);
contentBox = box.GetContentBox(drawBox, UIScale);
}
else
{
@@ -223,7 +223,7 @@ namespace Robust.Client.UserInterface.Controls
}
var panel = _getPanel();
var panelSize = (panel?.MinimumSize ?? Vector2.Zero) / UIScale;
var panelSize = (panel?.MinimumSize ?? Vector2.Zero);
var contentsSize = availableSize - headerSize - panelSize;
@@ -252,7 +252,7 @@ namespace Robust.Client.UserInterface.Controls
var contentBox = new UIBox2i(0, headerSize, (int) (finalSize.X * UIScale), (int) (finalSize.Y * UIScale));
if (panel != null)
{
contentBox = (UIBox2i) panel.GetContentBox(contentBox);
contentBox = (UIBox2i) panel.GetContentBox(contentBox, UIScale);
}
var control = GetChild(_currentTab);
@@ -322,6 +322,7 @@ namespace Robust.Client.UserInterface.Controls
}
}
// Returns the size of the header, in real pixels
[System.Diagnostics.Contracts.Pure]
private int _getHeaderSize()
{
@@ -333,8 +334,8 @@ namespace Robust.Client.UserInterface.Controls
var inactive = _getTabBoxInactive();
var font = _getFont();
var activeSize = active?.MinimumSize ?? Vector2.Zero;
var inactiveSize = inactive?.MinimumSize ?? Vector2.Zero;
var activeSize = (active?.MinimumSize ?? Vector2.Zero) * UIScale;
var inactiveSize = (inactive?.MinimumSize ?? Vector2.Zero) * UIScale;
headerSize = (int) MathF.Max(activeSize.Y, inactiveSize.Y);
headerSize += font.GetHeight(UIScale);