HydraUI

HydraUI

841k Downloads

Discussing UI scaling

BenjaminHamon opened this issue ยท 3 comments

commented

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:

  • If the HydraUI scaling value is set as suggested, in this case 0.5333, the final argument to SetScale becomes 1, since the operation is basically suggestedScale / suggestedScale. Thus, the HydraUI elements are rendered with a scale of 1, and look normal relatively to the rest of the UI.
  • If the HydraUI scaling is set to a larger value than suggested, for example 0.75, the denominator value increases, thus the final argument to SetScale becomes lower than 1, and the HydraUI elements are smaller relatively to the rest of the UI.
  • If the HydraUI scaling is set to a smaller value than suggested, for example 0.4, the denominator value decreases, thus the final argument to SetScale becomes higher than 1, and the HydraUI elements are larger relatively to the rest of the UI.

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.

commented

Related (but old) issue: #29

commented

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

commented

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.