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
This commit is contained in:
@@ -25,7 +25,6 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
internal sealed class ExamineSystem : ExamineSystemShared
|
internal sealed class ExamineSystem : ExamineSystemShared
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
|
||||||
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
const float minWidth = 300;
|
const float minWidth = 300;
|
||||||
CloseTooltip();
|
CloseTooltip();
|
||||||
|
|
||||||
var popupPos = _inputManager.MouseScreenPosition;
|
var popupPos = _userInterfaceManager.MousePositionScaled;
|
||||||
|
|
||||||
// Actually open the tooltip.
|
// Actually open the tooltip.
|
||||||
_examineTooltipOpen = new Popup();
|
_examineTooltipOpen = new Popup();
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
_userInterfaceManager.ModalRoot.AddChild(_currentEntityList);
|
_userInterfaceManager.ModalRoot.AddChild(_currentEntityList);
|
||||||
|
|
||||||
var size = _currentEntityList.List.CombinedMinimumSize;
|
var size = _currentEntityList.List.CombinedMinimumSize;
|
||||||
var box = UIBox2.FromDimensions(args.ScreenCoordinates.Position, size);
|
var box = UIBox2.FromDimensions(_userInterfaceManager.MousePositionScaled, size);
|
||||||
_currentEntityList.Open(box);
|
_currentEntityList.Open(box);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -190,7 +190,7 @@ namespace Content.Client.GameObjects.EntitySystems
|
|||||||
|
|
||||||
private void OnContextButtonPressed(IEntity entity)
|
private void OnContextButtonPressed(IEntity entity)
|
||||||
{
|
{
|
||||||
OpenContextMenu(entity, new ScreenCoordinates(_inputManager.MouseScreenPosition));
|
OpenContextMenu(entity, new ScreenCoordinates(_userInterfaceManager.MousePositionScaled));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg)
|
private void FillEntityPopup(VerbSystemMessages.VerbsResponseMessage msg)
|
||||||
|
|||||||
Reference in New Issue
Block a user