mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-08 03:18:58 +00:00
Keep status bars true to their value on ClassicAPI 1.18.0
ClassicAPI 1.18.0 divides the UI scale out of an anchored frame's GetWidth/GetHeight, as 4.3.4 does. The status bar still divided it out itself, so under a UI scale below 1 the bar emptied early (at 29% health on a 0.71 scale). Only divide on older ClassicAPI. Fixes #71
This commit is contained in:
+6
-2
@@ -6,6 +6,10 @@ do -- statusbars
|
|||||||
local stepsize, val
|
local stepsize, val
|
||||||
local width, height, point
|
local width, height, point
|
||||||
|
|
||||||
|
-- ClassicAPI before v1.18.0 leaves the UI scale in the size of an anchored
|
||||||
|
-- frame, so the bar has to divide it back out
|
||||||
|
local scaledsize = CLASSIC_API_VERSION < 11800
|
||||||
|
|
||||||
local animate = CreateFrame("Frame", "pfStatusBarAnimation", UIParent)
|
local animate = CreateFrame("Frame", "pfStatusBarAnimation", UIParent)
|
||||||
animate:SetScript("OnUpdate", function()
|
animate:SetScript("OnUpdate", function()
|
||||||
stepsize = tonumber(pfUI_config.unitframes.animation_speed)
|
stepsize = tonumber(pfUI_config.unitframes.animation_speed)
|
||||||
@@ -33,7 +37,7 @@ do -- statusbars
|
|||||||
|
|
||||||
if self.mode == "vertical" then
|
if self.mode == "vertical" then
|
||||||
height = self:GetHeight()
|
height = self:GetHeight()
|
||||||
height = height / self:GetEffectiveScale()
|
if scaledsize then height = height / self:GetEffectiveScale() end
|
||||||
point = height / (self.max - self.min) * (val - self.min)
|
point = height / (self.max - self.min) * (val - self.min)
|
||||||
|
|
||||||
-- keep values in limits
|
-- keep values in limits
|
||||||
@@ -51,7 +55,7 @@ do -- statusbars
|
|||||||
self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, point)
|
self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, point)
|
||||||
else
|
else
|
||||||
width = self:GetWidth()
|
width = self:GetWidth()
|
||||||
width = width / self:GetEffectiveScale()
|
if scaledsize then width = width / self:GetEffectiveScale() end
|
||||||
point = width / (self.max - self.min) * (val - self.min)
|
point = width / (self.max - self.min) * (val - self.min)
|
||||||
|
|
||||||
-- keep values in limits
|
-- keep values in limits
|
||||||
|
|||||||
Reference in New Issue
Block a user