From cb2f5878712ec65577b8ca44cd91fd8da22dfb5f Mon Sep 17 00:00:00 2001 From: James Whitehead II Date: Thu, 11 Mar 2010 17:40:22 +0000 Subject: [PATCH] Hide the tooltip when a plugin is clicked --- NinjaPanel.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/NinjaPanel.lua b/NinjaPanel.lua index b87231b..722e2d1 100644 --- a/NinjaPanel.lua +++ b/NinjaPanel.lua @@ -65,6 +65,7 @@ end) -- Local functions that are defined below local SortWeightName local Button_OnEnter, Button_OnLeave +local Button_OnMouseDown local Button_OnDragStart, Button_OnDragStop, Button_OnUpdateDragging local Button_Tooltip_OnEnter, Button_Tooltip_OnLeave local Panel_UpdateLayout @@ -451,6 +452,7 @@ function Panel_UpdateLayout(self) NinjaPanel:UpdateTooltipHandlers(button, entry.object) button:SetScript("OnClick", entry.object.OnClick) + button:SetScript("OnMouseDown", Button_OnMouseDown) button:SetScript("OnDragStart", Button_OnDragStart) button:SetScript("OnDragStop", Button_OnDragStop) button:RegisterForDrag("LeftButton") @@ -513,6 +515,13 @@ function SortWeightName(a,b) end end +function Button_OnMouseDown(self, ...) + if self.tooltip_shown then + GameTooltip:Hide() + self.tooltip_shown = false; + end +end + function Button_OnEnter(self, ...) GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT") @@ -523,6 +532,7 @@ function Button_OnEnter(self, ...) GameTooltip:SetText(self.entry.name) end GameTooltip:Show() + self.tooltip_shown = true end function Button_OnLeave(self, ...) -- 1.7.9.5