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
+13 -26
View File
@@ -136,17 +136,19 @@ pfUI:RegisterModule("firstrun", function ()
local f = CreateFirstRunPage()
f.text:SetText(T["A new installation of |cff33ffccpf|rUI ships with 4 prebuilt design profiles. Click below if you wish to load one of these profiles."])
local function LoadProfile(name)
_G["pfUI_config"] = CopyTable(pfUI_profiles[name])
pfUI_init.selected_profile = name
pfUI:LoadConfig()
ReloadUI()
end
f.Modern = CreateFrame("Button", nil, f, "UIPanelButtonTemplate")
f.Modern:SetSize(120, 20)
f.Modern:SetPoint("BOTTOM", -65, 100)
f.Modern:SetTextColor(1,1,1)
f.Modern:SetText("Modern")
f.Modern:SetScript("OnClick", function()
_G["pfUI_config"] = CopyTable(pfUI_profiles["Modern"])
pfUI_init.selected_profile = "Modern"
pfUI:LoadConfig()
ReloadUI()
end)
f.Modern:SetScript("OnClick", function() LoadProfile("Modern") end)
SkinButton(f.Modern)
f.Nostalgia = CreateFrame("Button", nil, f, "UIPanelButtonTemplate")
@@ -154,12 +156,7 @@ pfUI:RegisterModule("firstrun", function ()
f.Nostalgia:SetPoint("BOTTOM", 65, 100)
f.Nostalgia:SetTextColor(1,1,1)
f.Nostalgia:SetText("Nostalgia")
f.Nostalgia:SetScript("OnClick", function()
_G["pfUI_config"] = CopyTable(pfUI_profiles["Nostalgia"])
pfUI_init.selected_profile = "Nostalgia"
pfUI:LoadConfig()
ReloadUI()
end)
f.Nostalgia:SetScript("OnClick", function() LoadProfile("Nostalgia") end)
SkinButton(f.Nostalgia)
f.Legacy = CreateFrame("Button", nil, f, "UIPanelButtonTemplate")
@@ -167,12 +164,7 @@ pfUI:RegisterModule("firstrun", function ()
f.Legacy:SetPoint("BOTTOM", 65, 75)
f.Legacy:SetTextColor(1,1,1)
f.Legacy:SetText("Legacy")
f.Legacy:SetScript("OnClick", function()
_G["pfUI_config"] = CopyTable(pfUI_profiles["Legacy"])
pfUI_init.selected_profile = "Legacy"
pfUI:LoadConfig()
ReloadUI()
end)
f.Legacy:SetScript("OnClick", function() LoadProfile("Legacy") end)
SkinButton(f.Legacy)
f.Slim = CreateFrame("Button", nil, f, "UIPanelButtonTemplate")
@@ -180,12 +172,7 @@ pfUI:RegisterModule("firstrun", function ()
f.Slim:SetPoint("BOTTOM", -65, 75)
f.Slim:SetTextColor(1,1,1)
f.Slim:SetText("Slim")
f.Slim:SetScript("OnClick", function()
_G["pfUI_config"] = CopyTable(pfUI_profiles["Slim"])
pfUI_init.selected_profile = "Slim"
pfUI:LoadConfig()
ReloadUI()
end)
f.Slim:SetScript("OnClick", function() LoadProfile("Slim") end)
SkinButton(f.Slim)
f.Slider = CreateFrame("Slider", "pfFirstRunWizardScaleSlider", f, "OptionsSliderTemplate")
@@ -196,14 +183,14 @@ pfUI:RegisterModule("firstrun", function ()
f.Slider:SetSize(240, 20)
f.Slider:SetPoint("BOTTOM", 0, 50)
f.Slider:SetOrientation('HORIZONTAL')
f.Slider:SetMinMaxValues(0.5, 2.0)
-- the game drops a uiScale under 0.64 for its automatic scale at login
f.Slider:SetMinMaxValues(0.64, 2.0)
f.Slider:SetValue(UIParent:GetScale())
f.Slider:SetScript("OnMouseUp", function()
local scale = round(this:GetValue(),2)
SetCVar("uiScale", scale)
SetCVar("useUiScale", 1)
UIParent:SetScale(scale)
this:SetValue(scale)
end)