Hydra-Mods / HydraUI

HydraUI is an interface replacement for World of Warcraft
https://www.curseforge.com/wow/addons/hydraui
21 stars 11 forks source link

Discussing UI scaling #53

Closed BenjaminHamon closed 2 years ago

BenjaminHamon commented 2 years ago

I want to start a discussion around setting the UI scale ratio for HydraUI, as I'm having a hard time getting my head around how it is supposed to work. Sorry if the long text is overkill.

WoW UI scaling behavior

The WoW UI is first scaled by the UIScale variable. This setting is accessible through the main menu: System > Advanced > UI Scaling. Its accurate value can be determined with the command /run print(GetCVar("UIScale")), and set with /run SetCVar("UIScale", <value>).

Wowpedia has a page dedicated to it, which notably explains how to get a pixel perfect display, by setting the scaling value to 768 / ScreenHeight.

Beyond this global setting, each UI element has a local scale value, so as to scale itself relatively to its parent. This is set with the function SetScale.

HydraUI current scaling implementation

HydraUI exposes a UI scaling setting for its own elements. This value is applied on top of the global scaling, as implemented in Tools.lua#L323:

function HydraUI:SetScale(x)
    self:UpdateScreenSize()
    self.UIParent:SetScale((768 / ScreenHeight) / min(1.2, max(0.4, x)))
end

Assuming a screen height of 1440, the suggested scaling is 0.5333 (768 / 1440) and can be set in the game settings. With the HydraUI scaling on top of that, this leads the following results:

Suggested implementation and changes

In my opinion, the logic should be that the HydraUI scale is unchanged when setting the scaling value to 1, larger for a larger value (1.1 means the UI is scaled to 110%), smaller for a smaller value (0.9 means the UI is scaled to 90%). Thus, I suggest to remove the local SetScale implementation and rely directly on the WoW API SetScale. Furthermore, the UI scaling suggested value should always be 1.

As a helper, and since HydraUI is a complete UI replacement, the HydraUI menu could allow the user to set the global UI scaling, determining the suggested scale as it currently does.

BenjaminHamon commented 2 years ago

Related (but old) issue: #29

Hydra-Mods commented 2 years ago

I've started investigating this, I'll update with news

Hydra-Mods commented 2 years ago

As per your suggestion I have decided to remove the UI scale setting, and leave the scaling up to the the setting provided by Blizzard.