Skip to content

Commit

Permalink
Fix Shuttle FTL (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
VMSolidus authored Jun 27, 2024
1 parent 3eb60a4 commit 3971ec3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Content.Client/Shuttles/UI/BaseShuttleControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ public BaseShuttleControl(float minRange, float maxRange, float range) : base(mi

protected void DrawData(DrawingHandleScreen handle, string text)
{
var coordsDimensions = handle.GetDimensions(Font, text, UIScale);
var coordsDimensions = handle.GetDimensions(Font, text, 1f);
const float coordsMargins = 5f;

handle.DrawString(Font,
new Vector2(coordsMargins, Height) - new Vector2(0f, coordsDimensions.Y + coordsMargins),
new Vector2(coordsMargins, PixelHeight) - new Vector2(0f, coordsDimensions.Y + coordsMargins),
text,
Color.FromSrgb(IFFComponent.SelfColor));
}
Expand Down
11 changes: 6 additions & 5 deletions Content.Client/Shuttles/UI/ShuttleMapControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ protected override void KeyBindUp(GUIBoundKeyEventArgs args)

var mapTransform = Matrix3.CreateInverseTransform(Offset, Angle.Zero);

if (beaconsOnly && TryGetBeacon(_beacons, mapTransform, args.RelativePosition, PixelRect, out var foundBeacon, out _))
if (beaconsOnly && TryGetBeacon(_beacons, mapTransform, args.RelativePixelPosition, PixelRect, out var foundBeacon, out _))
{
RequestBeaconFTL?.Invoke(foundBeacon.Entity, _ftlAngle);
}
Expand Down Expand Up @@ -206,7 +206,8 @@ private void DrawParallax(DrawingHandleScreen handle)
private List<IMapObject> GetViewportMapObjects(Matrix3 matty, List<IMapObject> mapObjects)
{
var results = new List<IMapObject>();
var viewBox = SizeBox.Scale(1.2f);
var enlargement = new Vector2i((int) (16 * UIScale), (int) (16 * UIScale));
var viewBox = new UIBox2i(Vector2i.Zero - enlargement, PixelSize + enlargement);

foreach (var mapObj in mapObjects)
{
Expand Down Expand Up @@ -398,8 +399,8 @@ protected override void Draw(DrawingHandleScreen handle)

foreach (var (gridUiPos, iffText) in sendStrings)
{
var textWidth = handle.GetDimensions(_font, iffText, UIScale);
handle.DrawString(_font, gridUiPos + textWidth with { X = -textWidth.X / 2f }, iffText, adjustedColor);
var textWidth = handle.GetDimensions(_font, iffText, 1f);
handle.DrawString(_font, gridUiPos + textWidth with { X = -textWidth.X / 2f, Y = textWidth.Y * UIScale }, iffText, adjustedColor);
}
}

Expand Down Expand Up @@ -587,7 +588,7 @@ private bool TryGetBeacon(IEnumerable<IMapObject> mapObjects, Matrix3 mapTransfo

var distance = (localPos - mousePos).Length();

if (distance > BeaconSnapRange ||
if (distance > BeaconSnapRange * UIScale ||
distance > nearestValue)
{
continue;
Expand Down

0 comments on commit 3971ec3

Please sign in to comment.