From 643862f9bb18fc1cdfe36b7dcef8a5754698b2c6 Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Wed, 17 Nov 2010 20:35:02 +0000 Subject: [PATCH] Possibly fix the bug that causes two portraits to show on rare occasions. --- Modules/Portrait/Portrait.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Modules/Portrait/Portrait.lua b/Modules/Portrait/Portrait.lua index eb2ee58..6ca093f 100644 --- a/Modules/Portrait/Portrait.lua +++ b/Modules/Portrait/Portrait.lua @@ -99,7 +99,7 @@ end function mod:SetUnit() if not self.text or not self.texture then return end - + SetPortraitTexture(self.texture, StarTip.unit or "mouseover") if not self.texture:GetTexture() then @@ -120,8 +120,12 @@ function mod:SetUnit() self.text:SetFormattedText('|T%s:%d|t %s', "", self.db.profile.size, self.text:GetText() or "") -- we only need a blank space for the texture end +local lasttxt = "" function mod:SetItem() if not self.text then return end + + local txt = self.text:GetText() + if txt == lasttxt then return end local link = select(2, GameTooltip:GetItem()) @@ -129,16 +133,21 @@ function mod:SetItem() --make sure the icon does not display twice on recipies, which fire OnTooltipSetItem twice self.text:SetFormattedText('|T%s:%d|t%s', GetItemIcon(link), 36, self.text:GetText()) end + lasttxt = self.text:GetGext() end function mod:SetSpell() if not self.text then return end + + local txt = self.text:GetText() + if txt == lasttxt then return end local id = select(3, GameTooltip:GetSpell()) local icon = id and select(3, GetSpellInfo(id)) if icon then self.text:SetFormattedText('|T%s:%d|t%s', icon, 36, self.text:GetText()) end + lasttxt = self.text:GetText() end function mod:OnHide() -- 1.7.9.5