From 879ba8f566a522a823e262680ce3b3ccb796055b Mon Sep 17 00:00:00 2001 From: MilleXIV Date: Mon, 5 Sep 2016 09:19:54 -0400 Subject: [PATCH] Setting a minimum bar height --- Libs/LibArtifactData-1.0/LibArtifactData-1.0.lua | 12 ++++++++++-- modules/currency.lua | 6 +++++- modules/tradeskill.lua | 8 +++++++- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Libs/LibArtifactData-1.0/LibArtifactData-1.0.lua b/Libs/LibArtifactData-1.0/LibArtifactData-1.0.lua index aae7f50..3767d5f 100644 --- a/Libs/LibArtifactData-1.0/LibArtifactData-1.0.lua +++ b/Libs/LibArtifactData-1.0/LibArtifactData-1.0.lua @@ -1,4 +1,4 @@ -local MAJOR, MINOR = "LibArtifactData-1.0", 6 +local MAJOR, MINOR = "LibArtifactData-1.0", 7 assert(_G.LibStub, MAJOR .. " requires LibStub") local lib = _G.LibStub:NewLibrary(MAJOR, MINOR) @@ -225,6 +225,10 @@ end local function GetViewedArtifactData() GetArtifactKnowledge() local itemID, _, name, icon, unspentPower, numRanksPurchased = GetArtifactInfo() -- TODO: appearance stuff needed? altItemID ? + if not itemID then + Debug("|cffff0000ERROR:|r", "GetArtifactInfo() returned nil.") + return + end viewedID = itemID Debug("GetViewedArtifactData", name, itemID) local numRanksPurchasable, power, maxPower = GetNumPurchasableTraits(numRanksPurchased, unspentPower) @@ -305,11 +309,11 @@ local function InitializeScan(event) end function private.PLAYER_ENTERING_WORLD(event) + frame:UnregisterEvent(event) _G.C_Timer.After(5, function() InitializeScan(event) frame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED") frame:RegisterEvent("CURRENCY_DISPLAY_UPDATE") - frame:UnregisterEvent("PLAYER_ENTERING_WORLD") end) end @@ -348,6 +352,10 @@ function private.ARTIFACT_XP_UPDATE(event) local numRanksPurchasable, power, maxPower = GetNumPurchasableTraits(numRanksPurchased, unspentPower) local artifact = artifacts[itemID] + if not artifact then + Debug("|cffff0000ERROR:|r", "artifact", itemID, "not found.") + return + end local diff = unspentPower - artifact.unspentPower if numRanksPurchased ~= artifact.numRanksPurchased then diff --git a/modules/currency.lua b/modules/currency.lua index 0964711..0bc514e 100644 --- a/modules/currency.lua +++ b/modules/currency.lua @@ -77,6 +77,10 @@ function CurrencyModule:Refresh() --self.xpFrame = self.xpFrame or CreateFrame("BUTTON", nil, self.currencyFrame) local textHeight = floor((xb:GetHeight() - 4) / 2) + local barHeight = (iconSize - textHeight - 2) + if barHeight < 2 then + barHeight = 2 + end self.xpIcon:SetTexture(xb.constants.mediaPath..'datatexts\\exp') self.xpIcon:SetSize(iconSize, iconSize) self.xpIcon:SetPoint('LEFT') @@ -95,7 +99,7 @@ function CurrencyModule:Refresh() end self.xpBar:SetMinMaxValues(0, UnitXPMax('player')) self.xpBar:SetValue(UnitXP('player')) - self.xpBar:SetSize(self.xpText:GetStringWidth(), (iconSize - textHeight - 2)) + self.xpBar:SetSize(self.xpText:GetStringWidth(), barHeight) self.xpBar:SetPoint('BOTTOMLEFT', self.xpIcon, 'BOTTOMRIGHT', 5, 0) self.xpBarBg:SetAllPoints() diff --git a/modules/tradeskill.lua b/modules/tradeskill.lua index 7df146b..6149d20 100644 --- a/modules/tradeskill.lua +++ b/modules/tradeskill.lua @@ -117,6 +117,12 @@ function TradeskillModule:StyleTradeskillFrame(framePrefix, profIndex) if skill == cap then textHeight = db.text.fontSize end + + local barHeight = (iconSize - textHeight - 2) + if barHeight < 2 then + barHeight = 2 + end + self[framePrefix..'Icon']:SetTexture(icon) self[framePrefix..'Icon']:SetSize(iconSize, iconSize) self[framePrefix..'Icon']:SetPoint('LEFT') @@ -136,7 +142,7 @@ function TradeskillModule:StyleTradeskillFrame(framePrefix, profIndex) else self[framePrefix..'Bar']:SetStatusBarColor(db.color.normal.r, db.color.normal.g, db.color.normal.b, db.color.normal.a) end - self[framePrefix..'Bar']:SetSize(self[framePrefix..'Text']:GetStringWidth(), (iconSize - textHeight - 2)) + self[framePrefix..'Bar']:SetSize(self[framePrefix..'Text']:GetStringWidth(), barHeight) self[framePrefix..'Bar']:SetPoint('BOTTOMLEFT', self[framePrefix..'Icon'], 'BOTTOMRIGHT', 5, 0) self[framePrefix..'BarBg']:SetAllPoints() -- 1.7.9.5