mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- added user-submitted "reverse direction" option that lets bars fill top to bottom instead of bottom to top
- added user-submitted horizontal position slider to lacerate count module
This commit is contained in:
@ -64,6 +64,7 @@ function IceBarElement.prototype:GetDefaultSettings()
|
||||
settings["side"] = IceCore.Side.Left
|
||||
settings["offset"] = 1
|
||||
settings["scale"] = 1
|
||||
settings["reverse"] = false
|
||||
settings["barFontSize"] = 12
|
||||
settings["lockUpperTextAlpha"] = true
|
||||
settings["lockLowerTextAlpha"] = false
|
||||
@ -165,6 +166,21 @@ function IceBarElement.prototype:GetOptions()
|
||||
order = 32
|
||||
}
|
||||
|
||||
opts["reverse"] =
|
||||
{
|
||||
type = 'toggle',
|
||||
name = 'Reverse direction',
|
||||
desc = 'Direction of bar movement',
|
||||
get = function()
|
||||
return self.moduleSettings.reverse
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.reverse = value
|
||||
self:Redraw()
|
||||
end,
|
||||
order = 32
|
||||
}
|
||||
|
||||
opts["headerVisibility"] = {
|
||||
type = 'header',
|
||||
name = 'Visibility settings',
|
||||
@ -631,7 +647,7 @@ function IceBarElement.prototype:CreateBar()
|
||||
|
||||
self.barFrame.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture())
|
||||
self.barFrame.bar:SetBlendMode(self.settings.barBlendMode)
|
||||
self.barFrame.bar:SetAllPoints(self.frame)
|
||||
self.barFrame.bar:SetAllPoints(self.barFrame)
|
||||
|
||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||
self.barFrame.bar:SetTexCoord(1, 0, 1-self.CurrScale, 1)
|
||||
@ -743,14 +759,29 @@ end
|
||||
|
||||
function IceBarElement.prototype:SetScale(texture, scale)
|
||||
local oldScale = self.CurrScale
|
||||
local min_y, max_y;
|
||||
|
||||
self.CurrScale = IceHUD:Clamp(self:LerpScale(scale), 0, 1)
|
||||
|
||||
if oldScale ~= self.CurrScale then
|
||||
if (texture == self.barFrame.bar) then
|
||||
if (self.moduleSettings.reverse) then
|
||||
self.barFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, (self.settings.barHeight - (self.CurrScale * self.settings.barHeight)))
|
||||
|
||||
min_y = 0;
|
||||
max_y = self.CurrScale;
|
||||
else
|
||||
self.barFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0)
|
||||
|
||||
min_y = 1-self.CurrScale;
|
||||
max_y = 1;
|
||||
end
|
||||
end
|
||||
|
||||
if (self.moduleSettings.side == IceCore.Side.Left) then
|
||||
texture:SetTexCoord(1, 0, 1-self.CurrScale, 1)
|
||||
texture:SetTexCoord(1, 0, min_y, max_y)
|
||||
else
|
||||
texture:SetTexCoord(0, 1, 1-self.CurrScale, 1)
|
||||
texture:SetTexCoord(0, 1, min_y, max_y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -42,6 +42,26 @@ function LacerateCount.prototype:GetOptions()
|
||||
order = 31
|
||||
}
|
||||
|
||||
opts["hpos"] = {
|
||||
type = "range",
|
||||
name = "Horizontal Position",
|
||||
desc = "Horizontal Position",
|
||||
get = function()
|
||||
return self.moduleSettings.hpos
|
||||
end,
|
||||
set = function(v)
|
||||
self.moduleSettings.hpos = v
|
||||
self:Redraw()
|
||||
end,
|
||||
min = -700,
|
||||
max = 700,
|
||||
step = 10,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 31
|
||||
}
|
||||
|
||||
opts["lacerateFontSize"] = {
|
||||
type = "range",
|
||||
name = "Lacerate Count Font Size",
|
||||
@ -127,6 +147,7 @@ end
|
||||
function LacerateCount.prototype:GetDefaultSettings()
|
||||
local defaults = LacerateCount.super.prototype.GetDefaultSettings(self)
|
||||
defaults["vpos"] = -20
|
||||
defaults["hpos"] = 0
|
||||
defaults["lacerateFontSize"] = 20
|
||||
defaults["lacerateMode"] = "Numeric"
|
||||
defaults["gradient"] = false
|
||||
@ -172,7 +193,7 @@ function LacerateCount.prototype:CreateFrame()
|
||||
self.frame:SetWidth(self.lacerateSize*5)
|
||||
self.frame:SetHeight(1)
|
||||
self.frame:ClearAllPoints()
|
||||
self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos)
|
||||
self.frame:SetPoint("TOP", self.parent, "BOTTOM", self.moduleSettings.hpos, self.moduleSettings.vpos)
|
||||
|
||||
self:Show(true)
|
||||
|
||||
|
Reference in New Issue
Block a user