From 28f78fb88df9156503969b9cd34071739cdac1d0 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Mon, 21 Nov 2022 21:57:57 -0300 Subject: [PATCH] Added Clamp to SetValue() on split_bar --- Libs/DF/fw.lua | 2 +- Libs/DF/split_bar.lua | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index d8bbb0c4..1ed0abc1 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 395 +local dversion = 396 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) diff --git a/Libs/DF/split_bar.lua b/Libs/DF/split_bar.lua index 5a102cb9..254790c4 100644 --- a/Libs/DF/split_bar.lua +++ b/Libs/DF/split_bar.lua @@ -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