Skip to content

Commit

Permalink
Apply UIScale to ControlWindow size
Browse files Browse the repository at this point in the history
  • Loading branch information
ike709 committed Oct 18, 2024
1 parent 6702924 commit 1ef0818
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion OpenDreamClient/Interface/Controls/ControlWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared;
using Robust.Shared.Configuration;

namespace OpenDreamClient.Interface.Controls;

public sealed class ControlWindow : InterfaceControl {
[Dependency] private readonly IClyde _clyde = default!;
[Dependency] private readonly IUserInterfaceManager _uiMgr = default!;
[Dependency] private readonly IConfigurationManager _configurationManager = default!;

private readonly ISawmill _sawmill = Logger.GetSawmill("opendream.window");

Expand Down Expand Up @@ -336,7 +339,11 @@ public override void SetProperty(string property, string value, bool manualWinse
switch (property) {
case "size":
if (_myWindow.osWindow is {ClydeWindow: not null}) {
_myWindow.osWindow.ClydeWindow.Size = new DMFPropertySize(value).Vector;
var size = new DMFPropertySize(value);
var uiScale = _configurationManager.GetCVar(CVars.DisplayUIScale);
size.X = (int)(size.X * uiScale);
size.Y = (int)(size.Y * uiScale);
_myWindow.osWindow.ClydeWindow.Size = size.Vector;
}

return;
Expand Down

0 comments on commit 1ef0818

Please sign in to comment.