Added Clamp to SetValue() on split_bar

This commit is contained in:
Tercio Jose
2022-11-21 21:57:57 -03:00
parent dde1bb28b8
commit 28f78fb88d
2 changed files with 7 additions and 1 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
local dversion = 395
local dversion = 396
local major, minor = "DetailsFramework-1.0", dversion
local DF, oldminor = LibStub:NewLibrary(major, minor)
+6
View File
@@ -12,6 +12,8 @@ local _unpack = unpack --lua local
local type = type --lua local
local _math_floor = math.floor --lua local
local maxStatusBarValue = 100000000
local cleanfunction = function() end
local APISplitBarFunctions
@@ -477,10 +479,12 @@ DF:Mixin(SplitBarMetaFunctions, DF.ScriptHookMixin)
self.currentValue = self.currentValue - valueChange
local barWidth = self:GetWidth()
self.currentValue = Clamp(self.currentValue, 0, maxStatusBarValue)
self.statusbar:SetValue(self.currentValue)
self.rightTexture:SetWidth(barWidth - barWidth*self.currentValue)
if (self.currentValue - 0.001 <= self.targetValue) then
self.targetValue = Clamp(self.targetValue, 0, maxStatusBarValue)
self:SetValue(self.targetValue)
self.currentValue = self.targetValue
if (not self.SparkAlwaysShow) then
@@ -506,11 +510,13 @@ DF:Mixin(SplitBarMetaFunctions, DF.ScriptHookMixin)
self.currentValue = self.currentValue + valueChange
local barWidth = self:GetWidth()
self.currentValue = Clamp(self.currentValue, 0, maxStatusBarValue)
self.statusbar:SetValue(self.currentValue)
local rightTextureSize = barWidth - barWidth*self.currentValue
self.rightTexture:SetWidth(rightTextureSize)
if (self.currentValue + 0.001 >= self.targetValue) then
self.targetValue = Clamp(self.targetValue, 0, maxStatusBarValue)
self:SetValue(self.targetValue)
self.currentValue = self.targetValue
if (not self.SparkAlwaysShow) then