From 3f92860d2b7d461f9cea2d804af4b6974a7bf1ee Mon Sep 17 00:00:00 2001 From: Jack Fox <35575261+DubiousDoggo@users.noreply.github.com> Date: Tue, 8 Mar 2022 01:53:01 -0600 Subject: [PATCH] fix popups (#7034) --- Content.Client/Popups/PopupSystem.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Content.Client/Popups/PopupSystem.cs b/Content.Client/Popups/PopupSystem.cs index d2499cd4ea..4761381d8a 100644 --- a/Content.Client/Popups/PopupSystem.cs +++ b/Content.Client/Popups/PopupSystem.cs @@ -4,6 +4,7 @@ using Content.Client.Stylesheets; using Content.Shared.GameTicking; using Content.Shared.Popups; using Robust.Client.Graphics; +using Robust.Client.Input; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Shared.GameObjects; @@ -17,6 +18,7 @@ namespace Content.Client.Popups { public sealed class PopupSystem : SharedPopupSystem { + [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!; @@ -34,7 +36,7 @@ namespace Content.Client.Popups public void PopupCursor(string message) { - PopupMessage(message, _userInterfaceManager.MousePositionScaled); + PopupMessage(message, _inputManager.MouseScreenPosition); } public void PopupCoordinates(string message, EntityCoordinates coordinates) @@ -62,9 +64,8 @@ namespace Content.Client.Popups _userInterfaceManager.PopupRoot.AddChild(label); label.Measure(Vector2.Infinity); - var minimumSize = label.DesiredSize; - label.InitialPos = coordinates.Position / label.UIScale - minimumSize / 2; + label.InitialPos = coordinates.Position / label.UIScale - label.DesiredSize / 2; LayoutContainer.SetPosition(label, label.InitialPos); _aliveLabels.Add(label); }