From d0637435a461dd0373048e297955e7f2ca9b4981 Mon Sep 17 00:00:00 2001 From: RDW Date: Wed, 19 Jul 2023 19:46:12 +0200 Subject: [PATCH] Refactor: Moved the progress bar toggle to a separate function --- Core/GUI/AnchoredTrackingBar.lua | 6 ++++++ Core/GUI/DataBrokerDisplay.lua | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Core/GUI/AnchoredTrackingBar.lua b/Core/GUI/AnchoredTrackingBar.lua index 6aa5d363..d97ad7e4 100644 --- a/Core/GUI/AnchoredTrackingBar.lua +++ b/Core/GUI/AnchoredTrackingBar.lua @@ -91,3 +91,9 @@ function GUI:UpdateBar() self.barGroup:Lock() end end + +function GUI:ToggleProgressBar() + Rarity.db.profile.bar.visible = not Rarity.db.profile.bar.visible + Rarity.GUI:UpdateBar() + Rarity.GUI:UpdateText() +end diff --git a/Core/GUI/DataBrokerDisplay.lua b/Core/GUI/DataBrokerDisplay.lua index d1f49283..b978b4c1 100644 --- a/Core/GUI/DataBrokerDisplay.lua +++ b/Core/GUI/DataBrokerDisplay.lua @@ -72,10 +72,7 @@ function dataobj:OnClick(button) (self.db.profile.tooltipActivation == CONSTANTS.TOOLTIP.ACTIVATION_METHOD_CLICK and isRightButton) or (self.db.profile.tooltipActivation == CONSTANTS.TOOLTIP.ACTIVATION_METHOD_HOVER and isLeftButton) then - -- Toggle progress bar visibility - R.db.profile.bar.visible = not R.db.profile.bar.visible - Rarity.GUI:UpdateBar() - Rarity.GUI:UpdateText() + Rarity.GUI:ToggleProgressBar() elseif self.db.profile.tooltipActivation == CONSTANTS.TOOLTIP.ACTIVATION_METHOD_CLICK and isLeftButton then if Rarity.Tooltips:IsTooltipAcquired("RarityTooltip") then Rarity:HideTooltip()