# HG changeset patch # User Flick # Date 1289499756 28800 # Node ID 77858d975df6ab112e9ae3143f31a7f4b25e551a # Parent 2e7a322e0195968360496741bcb8f236460f82f5 Fix showgrid for action buttons in combat. HasAction() isn't updated prior to ACTIONBAR_HIDEGRID being fired, so capture drags and clicks and assume that HasAction() will report true immediately afterward. diff -r 2e7a322e0195 -r 77858d975df6 classes/ActionButton.lua --- a/classes/ActionButton.lua Fri Oct 22 23:48:02 2010 +0000 +++ b/classes/ActionButton.lua Thu Nov 11 10:22:36 2010 -0800 @@ -88,15 +88,23 @@ local _childupdate_showgrid = -- function(self, snippetid, message) [[ + showgrid_event = message self:SetAttribute("showgrid-event",message) if not self:GetAttribute("showgrid") then local count = message + (self:GetAttribute("showgrid-temp") or 0) if count <= 0 then local action = self:GetAttribute("action") - if HasAction(action) then - self:Show() - else - self:Hide() + -- note that HasAction is not updated on the target of a drag until after ACTIONBAR_HIDEGRID + -- so, we set a flag for this button in pre-click/receive-drag and check for it here + if HasAction(action) or self:GetAttribute("showgrid-clicked") then + if not self:IsShown() then + self:Show() + end + self:SetAttribute("showgrid-clicked",false) + else + if self:IsShown() then + self:Hide() + end end else self:Show() @@ -118,10 +126,21 @@ if kind ~= "spell" and kind ~= "item" and kind ~= "macro" then return kind, value, ... else + if showgrid_event and showgrid_event > 0 then + self:SetAttribute("showgrid-clicked",true) + end return "action", self:GetAttribute("action") end ]] +local _onClick = -- function(self, button, down) +[[ + if showgrid_event and showgrid_event > 0 then + self:SetAttribute("showgrid-clicked",true) + end + return button +]] + -- -- private -- @@ -206,6 +225,7 @@ f:SetAttribute("_childupdate-showgrid",_childupdate_showgrid) barFrame:WrapScript(f, "OnDragStart", _onDragStart) barFrame:WrapScript(f, "OnReceiveDrag", _onReceiveDrag) + barFrame:WrapScript(f, "OnClick", _onClick) -- attach to skinner bar:SkinButton(self)