mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- Suppress bar animations if update rate is less than 15/sec
This commit is contained in:
@ -22,6 +22,8 @@ local lastMarkerColorConfig = {r=1, b=0, g=0, a=1}
|
|||||||
local lastMarkerHeightConfig = 6
|
local lastMarkerHeightConfig = 6
|
||||||
local lastEditMarkerConfig = 1
|
local lastEditMarkerConfig = 1
|
||||||
|
|
||||||
|
local MIN_ANIMATED_UPDATED_RATE = 15
|
||||||
|
|
||||||
-- Constructor --
|
-- Constructor --
|
||||||
function IceBarElement.prototype:init(name, ...)
|
function IceBarElement.prototype:init(name, ...)
|
||||||
IceBarElement.super.prototype.init(self, name, ...)
|
IceBarElement.super.prototype.init(self, name, ...)
|
||||||
@ -357,9 +359,28 @@ do
|
|||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(info, value)
|
||||||
self.moduleSettings.shouldAnimate = value
|
self.moduleSettings.shouldAnimate = value
|
||||||
|
self.moduleSettings.wasAnimated = value
|
||||||
self:Redraw()
|
self:Redraw()
|
||||||
end,
|
end,
|
||||||
disabled = function()
|
disabled = function()
|
||||||
|
-- If below threshold, turn off and remember if we were on
|
||||||
|
if 1/IceHUD.IceCore:UpdatePeriod() < MIN_ANIMATED_UPDATED_RATE then
|
||||||
|
if self.moduleSettings.shouldAnimate then
|
||||||
|
self.moduleSettings.wasAnimated = true
|
||||||
|
self.moduleSettings.shouldAnimate = false
|
||||||
|
IceHUD:NotifyOptionsChange()
|
||||||
|
self:Redraw()
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
|
||||||
|
-- If above threshold, if we're off but were on, turn back on
|
||||||
|
elseif not self.moduleSettings.shouldAnimate and self.moduleSettings.wasAnimated then
|
||||||
|
self.moduleSettings.shouldAnimate = true
|
||||||
|
self.moduleSettings.wasAnimated = false
|
||||||
|
IceHUD:NotifyOptionsChange()
|
||||||
|
self:Redraw()
|
||||||
|
end
|
||||||
|
|
||||||
return not self.moduleSettings.enabled
|
return not self.moduleSettings.enabled
|
||||||
end,
|
end,
|
||||||
order = 111
|
order = 111
|
||||||
|
Reference in New Issue
Block a user