fix popups (#7034)

This commit is contained in:
Jack Fox
2022-03-08 01:53:01 -06:00
committed by GitHub
parent 367edcfdb1
commit 3f92860d2b

View File

@@ -4,6 +4,7 @@ using Content.Client.Stylesheets;
using Content.Shared.GameTicking; using Content.Shared.GameTicking;
using Content.Shared.Popups; using Content.Shared.Popups;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using Robust.Client.Input;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -17,6 +18,7 @@ namespace Content.Client.Popups
{ {
public sealed class PopupSystem : SharedPopupSystem public sealed class PopupSystem : SharedPopupSystem
{ {
[Dependency] private readonly IInputManager _inputManager = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!; [Dependency] private readonly IEyeManager _eyeManager = default!;
@@ -34,7 +36,7 @@ namespace Content.Client.Popups
public void PopupCursor(string message) public void PopupCursor(string message)
{ {
PopupMessage(message, _userInterfaceManager.MousePositionScaled); PopupMessage(message, _inputManager.MouseScreenPosition);
} }
public void PopupCoordinates(string message, EntityCoordinates coordinates) public void PopupCoordinates(string message, EntityCoordinates coordinates)
@@ -62,9 +64,8 @@ namespace Content.Client.Popups
_userInterfaceManager.PopupRoot.AddChild(label); _userInterfaceManager.PopupRoot.AddChild(label);
label.Measure(Vector2.Infinity); 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); LayoutContainer.SetPosition(label, label.InitialPos);
_aliveLabels.Add(label); _aliveLabels.Add(label);
} }