UI scale: size borders from the scale the game applies, mirror its options

GetPerfectPixel divided by the uiScale option, or by 1 while useUiScale was
off, though the game's automatic scale is never under 0.9, so default
borders came out about a tenth of a pixel thin. The game scales UIParent
only after add-ons and saved variables load, so the pixel now comes from
GetPhysicalScreenSize and the scale the game is about to apply, worked out
from the same options and rules as OnDisplaySizeChanged. UI_SCALE_CHANGED
offers a reload once when the pixel size changes.

The preset dropdown and the pixelperfect module go: its presets were pixel
perfect only at 1080p and its restore path never ran. The settings show the
game's own Use UI-Scale and UI-Scale options, plus a Pixel Perfect UI-Scale
checkbox (one UI unit per screen pixel, kept through window resizes) that
overrides them. The pixel perfect border and HiDPI options go too; border
sizes now count real pixels. CVAR settings rows write their option through
their own config instead of this:GetParent(), which a dropdown's menu
button is not. The first-run slider stops at 0.64, below which the game
drops uiScale for its automatic scale.
This commit is contained in:
Brues
2026-11-02 16:12:15 -06:00
parent f7769ec6ac
commit a0c47aa1cf
7 changed files with 79 additions and 102 deletions
+19 -12
View File
@@ -130,7 +130,7 @@ pfUI:RegisterModule("gui", function ()
category = {}
category[config] = tostring(GetCVar(config))
ufunc = function()
SetCVar(this:GetParent().config, this:GetParent().category[config])
SetCVar(config, category[config])
end
end
@@ -881,14 +881,6 @@ pfUI:RegisterModule("gui", function ()
"35:35",
"40:40",
},
["scaling"] = {
"0:" .. T["Off"],
"4:" .. T["Huge (PixelPerfect)"],
"5:" .. T["Large"],
"6:" .. T["Medium"],
"7:" .. T["Small"],
"8:" .. T["Tiny (PixelPerfect)"],
},
["abbrevnum"] = {
"0:" .. T["Full Numbers (4250)"],
"1:" .. T["Abbreviate 2 Decimals (4.25k)"],
@@ -1508,7 +1500,24 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Settings"], nil, nil, "header")
CreateConfig(nil, T["Language"], C.global, "language", "dropdown", pfUI.gui.dropdowns.languages)
CreateConfig(U["pixelperfect"], T["Enable UI-Scale"], C.global, "pixelperfect", "dropdown", pfUI.gui.dropdowns.scaling)
-- the game's own scale options, as in its Video Options; the list keeps
-- a value set there that is none of these steps
CreateConfig(nil, T["Use UI-Scale"], "CVAR", "useUiScale", "checkbox")
CreateConfig(nil, T["UI-Scale"], "CVAR", "uiScale", "dropdown", function()
local current = GetCVar("uiScale")
local values, found = {}, nil
for _, scale in ipairs({ .64, .65, .7, .75, .8, .85, .9, .95, 1, 1.1, 1.2, 1.3, 1.4, 1.5 }) do
if math.abs(scale - tonumber(current)) < .001 then
found = true
table.insert(values, current .. ":" .. scale)
else
table.insert(values, tostring(scale))
end
end
if not found then table.insert(values, 1, current .. ":" .. round(tonumber(current), 2)) end
return values
end)
CreateConfig(nil, string.format(T["Pixel Perfect UI-Scale: %s (Overrides UI-Scale)"], round(PixelUtil.GetPixelToUIUnitFactor(), 2)), C.global, "pixelperfect", "checkbox")
CreateConfig(nil, T["Use Original Game Fonts"], C.global, "font_blizzard", "checkbox")
CreateConfig(nil, T["Enable Region Compatible Font"], C.global, "force_region", "checkbox")
CreateConfig(nil, T["Standard Text Font"], C.global, "font_default", "dropdown", pfUI.gui.dropdowns.fonts)
@@ -1585,8 +1594,6 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Frame Shadow Intensity"], C.appearance.border, "shadow_intensity", "dropdown", pfUI.gui.dropdowns.uf_debuff_indicator_size)
CreateConfig(nil) -- spacer
CreateConfig(nil, T["Force Blizzard Borders (|cffffaaaaExperimental|r)"], C.appearance.border, "force_blizz", "checkbox")
CreateConfig(nil, T["Enable Pixel Perfect Borders"], C.appearance.border, "pixelperfect", "checkbox")
CreateConfig(nil, T["Scale Border On HiDPI Displays"], C.appearance.border, "hidpi", "checkbox")
CreateConfig(nil) -- spacer
CreateConfig(nil, T["Global Border Size"], C.appearance.border, "default", "dropdown", pfUI.gui.dropdowns.border)
CreateConfig(nil, T["Action Bar Border Size"], C.appearance.border, "actionbars", "dropdown", pfUI.gui.dropdowns.border)