From d170e3e73ff13de6d388ce139552cafcd4d70aa9 Mon Sep 17 00:00:00 2001 From: Tek Hudson Date: Fri, 10 Jan 2020 17:30:26 -0800 Subject: [PATCH] Fix mouse over issue --- DruidBar.lua | 70 ++++++++++++++++++++++++++++++++-------------------------- Options.lua | 4 ++-- 2 files changed, 41 insertions(+), 33 deletions(-) diff --git a/DruidBar.lua b/DruidBar.lua index 637a67c..517b4ca 100644 --- a/DruidBar.lua +++ b/DruidBar.lua @@ -338,44 +338,52 @@ function DruidBar_MainGraphics() end end -function DruidBar_TextRenderer() - dbarHide(DruidBarTextLeft); - dbarHide(DruidBarTextCenter); - dbarHide(DruidBarTextRight); - - -- Text options -- - if DruidBarKey.Text or (not DruidBarKey.Text) then - if DruidBarKey.Percent then - if DruidBarKey.Percent == 0 then -- Numbers - dbarShow(DruidBarTextCenter); - DruidBarTextCenter:SetText(ManaValues()); - DruidBarTextCenter:SetTextColor(1,1,1,1); - elseif DruidBarKey.Percent == 1 then -- Percent - dbarShow(DruidBarTextCenter); - DruidBarTextCenter:SetText(ManaPercentage()); - DruidBarTextCenter:SetTextColor(1,1,1,1); - elseif DruidBarKey.Percent == 2 then -- Bliz-Like +function DruidBar_TextStyle() + if DruidBarKey.Percent then + if DruidBarKey.Percent == 0 then -- Numbers + dbarShow(DruidBarTextCenter); + DruidBarTextCenter:SetText(ManaValues()); + DruidBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 1 then -- Percent + dbarShow(DruidBarTextCenter); + DruidBarTextCenter:SetText(ManaPercentage()); + DruidBarTextCenter:SetTextColor(1,1,1,1); + elseif DruidBarKey.Percent == 2 then -- Bliz-Like dbarShow(DruidBarTextLeft); dbarShow(DruidBarTextRight); DruidBarTextLeft:SetText(ManaPercentage()); DruidBarTextRight:SetText(CurrentMana()); DruidBarTextLeft:SetTextColor(1,1,1,1); DruidBarTextRight:SetTextColor(1,1,1,1); - end - else -- Both - dbarShow(DruidBarTextCenter); - DruidBarTextCenter:SetText(ManaValuesAndPercentage()); - DruidBarTextCenter:SetTextColor(1,1,1,1); end + else -- Both + dbarShow(DruidBarTextCenter); + DruidBarTextCenter:SetText(ManaValuesAndPercentage()); + DruidBarTextCenter:SetTextColor(1,1,1,1); + end + + if DruidBarKey.Text == 0 then + DruidBarTextLeft:SetFontObject("GameTooltipTextSmall"); + DruidBarTextCenter:SetFontObject("GameTooltipTextSmall"); + DruidBarTextRight:SetFontObject("GameTooltipTextSmall"); + elseif DruidBarKey.Text == 1 then + DruidBarTextLeft:SetFontObject("TextStatusBarText"); + DruidBarTextCenter:SetFontObject("TextStatusBarText"); + DruidBarTextRight:SetFontObject("TextStatusBarText"); + end +end - if DruidBarKey.Text == 0 then - DruidBarTextLeft:SetFontObject("GameTooltipTextSmall"); - DruidBarTextCenter:SetFontObject("GameTooltipTextSmall"); - DruidBarTextRight:SetFontObject("GameTooltipTextSmall"); - elseif DruidBarKey.Text == 1 then - DruidBarTextLeft:SetFontObject("TextStatusBarText"); - DruidBarTextCenter:SetFontObject("TextStatusBarText"); - DruidBarTextRight:SetFontObject("TextStatusBarText"); +function DruidBar_TextRenderer() + dbarHide(DruidBarTextLeft); + dbarHide(DruidBarTextCenter); + dbarHide(DruidBarTextRight); + + -- Text options -- + if DruidBarKey.Text then + if DruidBarKey.Text == 0 or DruidBarKey.Text == 1 then + DruidBar_TextStyle() + elseif DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)) then + DruidBar_TextStyle() end end end @@ -422,7 +430,7 @@ function DruidBar_ReplaceGraphics() str1 = "|CFFFFFFFF"..(floor(DruidBarKey.currentmana / 100)/10).."k,"..floor(DruidBarKey.currentmana / DruidBarKey.maxmana * 100).."%|r"; end -- DruidBarReplaceText:SetFrameLevel("2"); - if (DruidBarKey.Text and DruidBarKey.Text == 1) or (not DruidBarKey.Text and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar)))then + if (DruidBarKey.Text and DruidBarKey.Text == 1) or (DruidBarKey.Text == 2 and (MouseIsOver(DruidBarFrame) or MouseIsOver(PlayerFrameManaBar))) then dbarShow(DEnergyText1); dbarShow(DManaText1); dbarHide(DManaText); diff --git a/Options.lua b/Options.lua index 466c427..123b1e0 100644 --- a/Options.lua +++ b/Options.lua @@ -158,7 +158,7 @@ function DRUIDBAROptions_Text_OnShow() UIDropDownMenu_SetSelectedID(DRUIDBAROptionsTextDropDown, 1); elseif( DruidBarKey.Text == 1 ) then -- NEW UIDropDownMenu_SetSelectedID(DRUIDBAROptionsTextDropDown, 2); - elseif( DruidBarKey.Text == nil ) then -- NO TEXT + elseif( DruidBarKey.Text == 2 ) then -- MOUSEOVER UIDropDownMenu_SetSelectedID(DRUIDBAROptionsTextDropDown, 3); end UIDropDownMenu_SetWidth(DRUIDBAROptionsTextDropDown, 100); @@ -173,7 +173,7 @@ function DRUIDBAROptions_Text_OnClick(self) elseif(i == 2) then DruidBarKey.Text = 1; elseif(i == 3) then - DruidBarKey.Text = nil; + DruidBarKey.Text = 2; end end -- 1.7.9.5