]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix shuttle IFF drawing (#25821)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 4 Mar 2024 05:15:47 +0000 (16:15 +1100)
committerGitHub <noreply@github.com>
Mon, 4 Mar 2024 05:15:47 +0000 (16:15 +1100)
Didn't account for UI scale properly I love transforms.

Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs

index 18122415f5e4fc3709f12a7e8db97d4b9886d780..00ee6890b28f18db83844792f86642a703a75cca 100644 (file)
@@ -212,18 +212,20 @@ public sealed partial class ShuttleNavControl : BaseShuttleControl
                 var distance = gridCentre.Length();
                 var labelText = Loc.GetString("shuttle-console-iff-label", ("name", labelName),
                     ("distance", $"{distance:0.0}"));
-                var labelDimensions = handle.GetDimensions(Font, labelText, UIScale);
+
+                // yes 1.0 scale is intended here.
+                var labelDimensions = handle.GetDimensions(Font, labelText, 1f);
 
                 // y-offset the control to always render below the grid (vertically)
-                var yOffset = Math.Max(gridBounds.Height, gridBounds.Width) * MinimapScale / 1.8f / UIScale;
+                var yOffset = Math.Max(gridBounds.Height, gridBounds.Width) * MinimapScale / 1.8f;
 
                 // The actual position in the UI. We offset the matrix position to render it off by half its width
                 // plus by the offset.
-                var uiPosition = ScalePosition(gridCentre) / UIScale - new Vector2(labelDimensions.X / 2f, -yOffset);
+                var uiPosition = ScalePosition(gridCentre)- new Vector2(labelDimensions.X / 2f, -yOffset);
 
                 // Look this is uggo so feel free to cleanup. We just need to clamp the UI position to within the viewport.
-                uiPosition = new Vector2(Math.Clamp(uiPosition.X, 0f, Width - labelDimensions.X),
-                    Math.Clamp(uiPosition.Y, 0f, Height - labelDimensions.Y));
+                uiPosition = new Vector2(Math.Clamp(uiPosition.X, 0f, PixelWidth - labelDimensions.X ),
+                    Math.Clamp(uiPosition.Y, 0f, PixelHeight - labelDimensions.Y));
 
                 handle.DrawString(Font, uiPosition, labelText, color);
             }