Fehler aus dem Code-Review behoben, Tests hinzugefügt
Leistenabstand: Leere, ausgeblendete Slots ("Immer Buttons anzeigen" aus)
werden mit angeordnet. Vorher wurde ihre Lücke zugeschoben, und sobald
sie wieder erschienen, lagen sie fast genau auf dem Nachbarbutton.
Buttons jenseits von "Anzahl Symbole" bleiben außen vor (numShowingButtons,
sonst bis zum letzten sichtbaren Button). Die Haltungsleiste ordnet weiter
nur sichtbare Buttons an.
Goldbeutel: "Diese Sitzung" läuft über /reload weiter (Startwert pro
Charakter gespeichert, Reset nur bei echtem Login). /gold forget findet
auch Namen mit Umlauten und Akzenten unabhängig von Groß-/Kleinschreibung.
ForeverScale: /fscale pixel ist jetzt ein Modus und wird bei jedem
Auflösungswechsel neu berechnet. Kann absichtlich unter 0,30 liegen.
README: Quellcode-Anhang auf den neuen Stand gebracht.
tests/: Mock-Tests für alle drei Addons (luajit tests/<datei>.lua).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
da38820c2e
commit
f1eca2d1c5
7 files changed
+425
-50
No files matched your search
@@ -1,14 +1,28 @@
|
||||
-- ForeverScale: re-applies a fixed UIParent scale on every login/reload,
|
||||
-- so values below Blizzard's 0.64 slider floor stick.
|
||||
-- /fscale 0.5333 set a scale (0.30 - 1.50), saved account-wide
|
||||
-- /fscale pixel pixel-perfect: 768 / your vertical resolution
|
||||
-- /fscale pixel pixel-perfect: 768 / your vertical resolution, worked out
|
||||
-- again whenever the resolution changes. Not limited to
|
||||
-- 0.30 - 1.50, so on 5K/6K screens it goes below 0.30.
|
||||
-- /fscale reset stop overriding (then /reload)
|
||||
|
||||
local ADDON = ...
|
||||
local f = CreateFrame("Frame")
|
||||
|
||||
-- the scale to enforce, or nil if there is no override
|
||||
local function target()
|
||||
local db = ForeverScaleDB
|
||||
if not db then return end
|
||||
if db.pixel then
|
||||
local _, h = GetPhysicalScreenSize()
|
||||
if h and h > 0 then return 768 / h end
|
||||
return
|
||||
end
|
||||
return db.scale
|
||||
end
|
||||
|
||||
local function apply()
|
||||
local s = ForeverScaleDB and ForeverScaleDB.scale
|
||||
local s = target()
|
||||
if not s then return end
|
||||
if InCombatLockdown() then
|
||||
-- UIParent has protected children; wait until combat ends
|
||||
@@ -46,12 +60,11 @@ SlashCmdList.FOREVERSCALE = function(msg)
|
||||
msg = strtrim(msg or ""):lower()
|
||||
|
||||
if msg == "reset" then
|
||||
ForeverScaleDB.scale = nil
|
||||
ForeverScaleDB.scale, ForeverScaleDB.pixel = nil, nil
|
||||
print("ForeverScale: override cleared. /reload to return to Blizzard's scale.")
|
||||
return
|
||||
elseif msg == "pixel" then
|
||||
local _, h = GetPhysicalScreenSize()
|
||||
ForeverScaleDB.scale = 768 / h
|
||||
ForeverScaleDB.scale, ForeverScaleDB.pixel = nil, true
|
||||
else
|
||||
local v = tonumber(msg)
|
||||
if not v or v < 0.3 or v > 1.5 then
|
||||
@@ -60,10 +73,11 @@ SlashCmdList.FOREVERSCALE = function(msg)
|
||||
UIParent:GetScale()))
|
||||
return
|
||||
end
|
||||
ForeverScaleDB.scale = v
|
||||
ForeverScaleDB.scale, ForeverScaleDB.pixel = v, nil
|
||||
end
|
||||
|
||||
apply()
|
||||
print(string.format("ForeverScale: scale set to %.4f%s", ForeverScaleDB.scale,
|
||||
print(string.format("ForeverScale: scale set to %.4f%s%s", target() or UIParent:GetScale(),
|
||||
ForeverScaleDB.pixel and " (pixel, follows your resolution)" or "",
|
||||
InCombatLockdown() and " (applies after combat)" or ""))
|
||||
end
|
||||
Reference in new issue
Block a user