- fixed a bug where the tooltip could be completely wrong or empty sometimes

This commit is contained in:
parnic
2010-12-14 06:22:16 +00:00
parent c3ee55d04c
commit fa59e6137d

View File

@ -667,12 +667,14 @@ function Breakables:FindBreakables(bag)
else else
btn:SetNormalTexture(foundBreakables[i][IDX_TEXTURE]) btn:SetNormalTexture(foundBreakables[i][IDX_TEXTURE])
end end
btn.bag = foundBreakables[i][IDX_BAG]
btn.slot = foundBreakables[i][IDX_SLOT]
if not btn.OnEnterFunc then if not btn.OnEnterFunc then
btn.OnEnterFunc = function(this) self:OnEnterBreakableButton(this, foundBreakables[i]) end btn.OnEnterFunc = function(this) self:OnEnterBreakableButton(this) end
end end
if not btn.OnLeaveFunc then if not btn.OnLeaveFunc then
btn.OnLeaveFunc = function() self:OnLeaveBreakableButton(foundBreakables[i]) end btn.OnLeaveFunc = function() self:OnLeaveBreakableButton() end
end end
btn:SetScript("OnEnter", btn.OnEnterFunc) btn:SetScript("OnEnter", btn.OnEnterFunc)
@ -718,16 +720,16 @@ function Breakables:OnLeaveProfessionButton()
GameTooltip:Hide() GameTooltip:Hide()
end end
function Breakables:OnEnterBreakableButton(this, breakable) function Breakables:OnEnterBreakableButton(this)
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT") GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT")
GameTooltip:SetBagItem(breakable[IDX_BAG], breakable[IDX_SLOT]) GameTooltip:SetBagItem(this.bag, this.slot)
GameTooltip:AddLine(" ") GameTooltip:AddLine(" ")
GameTooltip:AddLine(L["You can click on this button to break this item without having to click on the profession button first."], 1, 1, 1, 1) GameTooltip:AddLine(L["You can click on this button to break this item without having to click on the profession button first."], 1, 1, 1, 1)
GameTooltip:Show() GameTooltip:Show()
end end
function Breakables:OnLeaveBreakableButton(breakable) function Breakables:OnLeaveBreakableButton()
GameTooltip:Hide() GameTooltip:Hide()
end end