From c4c4a1ca8c93a66348522bf5a8178903bba8d2aa Mon Sep 17 00:00:00 2001 From: "R. Neuser" Date: Fri, 4 Dec 2020 08:24:22 -0600 Subject: [PATCH] Use MousePositionScaled instead of absolute MousePosition to fix UI-scaling issues (#2568) * Use MousePositionScaled instead of absolute MousePosition to fix UI-scaling issues * Fix compiler warnings --- Content.Client/GameObjects/EntitySystems/ExamineSystem.cs | 3 +-- Content.Client/GameObjects/EntitySystems/VerbSystem.cs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs index d31f1835cd..42e61f6bcb 100644 --- a/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/ExamineSystem.cs @@ -25,7 +25,6 @@ namespace Content.Client.GameObjects.EntitySystems [UsedImplicitly] internal sealed class ExamineSystem : ExamineSystemShared { - [Dependency] private readonly IInputManager _inputManager = default!; [Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; @@ -72,7 +71,7 @@ namespace Content.Client.GameObjects.EntitySystems const float minWidth = 300; CloseTooltip(); - var popupPos = _inputManager.MouseScreenPosition; + var popupPos = _userInterfaceManager.MousePositionScaled; // Actually open the tooltip. _examineTooltipOpen = new Popup(); diff --git a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs index cc7de7651b..47a78456b5 100644 --- a/Content.Client/GameObjects/EntitySystems/VerbSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/VerbSystem.cs @@ -182,7 +182,7 @@ namespace Content.Client.GameObjects.EntitySystems _userInterfaceManager.ModalRoot.AddChild(_currentEntityList); var size = _currentEntityList.List.CombinedMinimumSize; - var box = UIBox2.FromDimensions(args.ScreenCoordinates.Position, size); + var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled, size); _currentEntityList.Open(box); return true; @@ -190,7 +190,7 @@ namespace Content.Client.GameObjects.EntitySystems private void OnContextButtonPressed(IEntity entity) { - OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition)); + OpenContextMenu(entity, new ScreenCoordinates(_userInterfaceManager.MousePositionScaled)); } private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg)