Fix bad this ref, update event name, and fix enable bug
Tek Hudson [08-10-19 - 08:05]
Fix bad this ref, update event name, and fix enable bug
diff --git a/DruidBar.lua b/DruidBar.lua
index 1407649..0273090 100644
--- a/DruidBar.lua
+++ b/DruidBar.lua
@@ -5,7 +5,7 @@ function DruidBar_OnLoad()
DruidBarUpdateFrame:RegisterEvent("UNIT_AURA");
DruidBarUpdateFrame:RegisterEvent("UNIT_MAXPOWER");
DruidBarUpdateFrame:RegisterEvent("COMBAT_LOG_EVENT");
- DruidBarUpdateFrame:RegisterEvent("VARIABLES_LOADED");
+ DruidBarUpdateFrame:RegisterEvent("ADDON_LOADED");
DruidBarUpdateFrame:RegisterEvent("UNIT_POWER_UPDATE");
DruidBarUpdateFrame:RegisterEvent("INSTANCE_BOOT_STOP");
DruidBarUpdateFrame:RegisterEvent("INSTANCE_BOOT_START");
@@ -53,7 +53,7 @@ function DruidBar_OnEvent(self, event,...)
return;
end
- if event == "VARIABLES_LOADED" then
+ if event == "ADDON_LOADED" then
Load_Variables(className);
elseif className and className == "DRUID" and DruidBarKey.Enabled then
-- Show DruidBarUpdateFrame if hidden
diff --git a/DruidBar.xml b/DruidBar.xml
index c0e4cdb..abba531 100644
--- a/DruidBar.xml
+++ b/DruidBar.xml
@@ -96,9 +96,9 @@
end
</OnMouseUp>
<OnHide>
- if ( this.isMoving ) then
+ if self.isMoving then
self:GetParent():StopMovingOrSizing();
- this.isMoving = false;
+ self.isMoving = false;
end
</OnHide>
</Scripts>
diff --git a/Options.lua b/Options.lua
index 5546198..1655d32 100644
--- a/Options.lua
+++ b/Options.lua
@@ -46,6 +46,9 @@ function DRUIDBAROptions_Toggle()
DruidBarKey.Enabled = false;
else
DruidBarKey.Enabled = true;
+ -- Show DruidBarUpdateFrame if hidden
+ -- Incase no other event triggers the redraw, we do this now
+ if not DruidBarUpdateFrame:IsVisible() then DruidBarUpdateFrame:Show(); end
end
DRUIDBAR_FrameSet();
end