mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-04 04:30:01 +00:00
ui-widgets: keep status bars in size limits
* make sure bar texture sizes are within 0-100% * always set both bar positions on change
This commit is contained in:
@@ -36,13 +36,33 @@ do -- statusbars
|
||||
height = self:GetHeight()
|
||||
if pfUI.expansion == "vanilla" then height = height / self:GetEffectiveScale() end
|
||||
point = height / (self.max - self.min) * (val - self.min)
|
||||
|
||||
-- keep values in limits
|
||||
point = math.min(height, point)
|
||||
point = math.max(0, point)
|
||||
|
||||
-- set status bar position/size
|
||||
self.bar:SetPoint("TOPLEFT", self, "TOPLEFT", 0, - height + point)
|
||||
self.bar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
|
||||
|
||||
-- set background bar position/size
|
||||
self.bg:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
|
||||
self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, point)
|
||||
else
|
||||
width = self:GetWidth()
|
||||
if pfUI.expansion == "vanilla" then width = width / self:GetEffectiveScale() end
|
||||
point = width / (self.max - self.min) * (val - self.min)
|
||||
|
||||
-- keep values in limits
|
||||
point = math.min(width, point)
|
||||
point = math.max(0, point)
|
||||
|
||||
-- set status bar position/size
|
||||
self.bar:SetPoint("TOPLEFT", self, "TOPLEFT", 0, 0)
|
||||
self.bar:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", - width + point, 0)
|
||||
|
||||
-- set background bar position/size
|
||||
self.bg:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", 0, 0)
|
||||
self.bg:SetPoint("TOPLEFT", self, "TOPLEFT", point, 0)
|
||||
end
|
||||
end,
|
||||
|
||||
Reference in New Issue
Block a user