diff --git a/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs b/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs index 39fd8038ebd..3bab926dcf2 100644 --- a/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs +++ b/Content.Client/Shuttles/UI/ShuttleNavControl.xaml.cs @@ -263,20 +263,20 @@ protected override void Draw(DrawingHandleScreen handle) var displayedDistance = distance < 50f ? $"{distance:0.0}" : distance < 1000 ? $"{distance:0}" : $"{distance / 1000:0.0}k"; var labelText = Loc.GetString("shuttle-console-iff-label", ("name", labelName)!, ("distance", displayedDistance)); - var textLengthCorrection = labelText.Length * 9.5f; - var sideCorrection = isOutsideRadarCircle && uiPosition.X > Width / 2 ? -textLengthCorrection : 0; - var blipCorrection = (RadarBlipSize * 0.7f); - var correctedUiPosition = uiPosition with - { - X = uiPosition.X > Width / 2 - ? uiPosition.X + blipCorrection + sideCorrection - : uiPosition.X + blipCorrection, - Y = uiPosition.Y - 10 // Wanted to use half the label height, but this makes text jump when visibility changes. - }; - if (!isOutsideRadarCircle || isDistantPOI || isMouseOver) { - handle.DrawString(Font, correctedUiPosition, labelText, color); + // Calculate unscaled offsets. + var labelDimensions = handle.GetDimensions(Font, labelText, 1f); + var blipSize = RadarBlipSize * 0.7f; + var labelOffset = new Vector2() + { + X = uiPosition.X > Width / 2f + ? -labelDimensions.X - blipSize // right align the text to left of the blip + : blipSize, // left align the text to the right of the blip + Y = -labelDimensions.Y / 2f + }; + + handle.DrawString(Font, (uiPosition + labelOffset) * UIScale, labelText, UIScale, color); } blipDataList.Add(new BlipData @@ -286,8 +286,6 @@ protected override void Draw(DrawingHandleScreen handle) VectorToPosition = uiPosition - new Vector2(uiXCentre, uiYCentre), Color = color }); - - } // Don't skip drawing blips if they're out of range.