FTL UIScale fixes (#26305)
- Fix text drawing being offset. - Fix beacon snapping and distance check. - Fix DrawData being offset. - Fix bounds check for map objects not using PixelSize.
This commit is contained in:
@@ -66,11 +66,11 @@ public partial class BaseShuttleControl : MapGridControl
|
|||||||
|
|
||||||
protected void DrawData(DrawingHandleScreen handle, string text)
|
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;
|
const float coordsMargins = 5f;
|
||||||
|
|
||||||
handle.DrawString(Font,
|
handle.DrawString(Font,
|
||||||
new Vector2(coordsMargins, Height) - new Vector2(0f, coordsDimensions.Y + coordsMargins),
|
new Vector2(coordsMargins, PixelHeight) - new Vector2(0f, coordsDimensions.Y + coordsMargins),
|
||||||
text,
|
text,
|
||||||
Color.FromSrgb(IFFComponent.SelfColor));
|
Color.FromSrgb(IFFComponent.SelfColor));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
|
|
||||||
var mapTransform = Matrix3.CreateInverseTransform(Offset, Angle.Zero);
|
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);
|
RequestBeaconFTL?.Invoke(foundBeacon.Entity, _ftlAngle);
|
||||||
}
|
}
|
||||||
@@ -206,7 +206,8 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
private List<IMapObject> GetViewportMapObjects(Matrix3 matty, List<IMapObject> mapObjects)
|
private List<IMapObject> GetViewportMapObjects(Matrix3 matty, List<IMapObject> mapObjects)
|
||||||
{
|
{
|
||||||
var results = new List<IMapObject>();
|
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)
|
foreach (var mapObj in mapObjects)
|
||||||
{
|
{
|
||||||
@@ -398,8 +399,8 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
|
|
||||||
foreach (var (gridUiPos, iffText) in sendStrings)
|
foreach (var (gridUiPos, iffText) in sendStrings)
|
||||||
{
|
{
|
||||||
var textWidth = handle.GetDimensions(_font, iffText, UIScale);
|
var textWidth = handle.GetDimensions(_font, iffText, 1f);
|
||||||
handle.DrawString(_font, gridUiPos + textWidth with { X = -textWidth.X / 2f }, iffText, adjustedColor);
|
handle.DrawString(_font, gridUiPos + textWidth with { X = -textWidth.X / 2f, Y = textWidth.Y * UIScale }, iffText, adjustedColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +588,7 @@ public sealed partial class ShuttleMapControl : BaseShuttleControl
|
|||||||
|
|
||||||
var distance = (localPos - mousePos).Length();
|
var distance = (localPos - mousePos).Length();
|
||||||
|
|
||||||
if (distance > BeaconSnapRange ||
|
if (distance > BeaconSnapRange * UIScale ||
|
||||||
distance > nearestValue)
|
distance > nearestValue)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user