Mercurial > wow > buffalo2
diff ObjectiveTracker/ObjectiveFrame.lua @ 25:4b3da1b221de v1.0-beta
- distinction between all possible types of values for the 'isComplete' field
- style polish applied to title headers
- clickable regions altered to somewhat match those of the blizzard objectives tracker, for more world frame space and quicker user familiarity
author | Nenue |
---|---|
date | Wed, 13 Apr 2016 11:20:09 -0400 |
parents | 66b927b46776 |
children |
line wrap: on
line diff
--- a/ObjectiveTracker/ObjectiveFrame.lua Mon Apr 11 09:07:40 2016 -0400 +++ b/ObjectiveTracker/ObjectiveFrame.lua Wed Apr 13 11:20:09 2016 -0400 @@ -34,19 +34,28 @@ local currentBlock --- todo: source these from config local itemButtonSize, itemButtonSpacing = 36, 1 -local titleFont, textFont = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]] -local titleSize, textSize = 16, 16 -local titlebg, textbg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}, {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } -local titlebg_daily, textbg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125}, {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 } -local textbg_account,titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125}, {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 } + +local headerHeight, headerColor, headerSpacing = 16, {1,1,1,1}, 2 +local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0} +local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE' + +local titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125} +local titlebg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125 } +local titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125} +local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE' + +local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } +local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 } +local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 } +local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE' + + local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225} -local titleOutline, textOutline = "OUTLINE", "OUTLINE" local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 local titleIndent, textIndent,selectionIndent = 2, 5, 50 + local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' -local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 -local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } local rewardSize = 32 local oprint = B.print('Objectives') @@ -177,8 +186,8 @@ block.Open = handler.Open block.Remove = handler.Remove block.Link = handler.Link - block:SetScript('OnMouseUp', handler.OnMouseUp) - block:SetScript('OnMouseDown', handler.OnMouseDown) + block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end) + block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end) block.attachmentHeight = 0 block:ClearAllPoints() @@ -230,11 +239,6 @@ local completionScore, completionMax = 0, 0 local displayObjectiveHeader = false - if info.description and #info.description >= 1 then - print(' |cFF00FFFF header line:|r', info.description) - block.status:SetText(info.description) - displayObjectiveHeader = true - end --- The first line is going to be used no matter what, so it is hard-pulled. -- It also ensures that we're in the right position for cleaning up the leftover lines. @@ -243,13 +247,27 @@ block.numLines = 0 block.attachmentHeight = 0 - if info.isComplete then - print(' overriding line #1 for a completed block') + + if info.description and #info.description >= 1 then + print(' |cFF00FFFF header line:|r', info.description) + line.status:SetText(info.description) + line.height = floor(line.status:GetStringHeight()+.5) + textSpacing if line.widget then line.widget:Hide() end + T.AddLine(block, line) + + lineIndex = lineIndex + 1 + line = T.GetLine(handler, block, lineIndex) + end + + if (info.isComplete == true or info.isComplete == nil) and info.completionText then + print(' overriding line #1 for completion text:', info.completionText) line.status:SetText(info.completionText) - line.height = floor(line.status:GetHeight()+.5) + textSpacing + line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + if line.widget then + line.widget:Hide() + end T.AddLine(block, line) else if info.objectives then @@ -498,7 +516,12 @@ local print = tprint local tracker = self.frame local blockIndex = 0 - local trackerHeight = floor(tracker.titlebg:GetHeight()+.5) + local trackerHeight = headerHeight + + tracker.title:SetFont(headerFont, headerSize, headerOutline) + tracker.titlebg:SetHeight(headerHeight) + tracker.title:SetTextColor(unpack(headerColor)) + --tracker.titlebg:SetGradientAlpha(unpack(headerbg)) self.currentAnchor = tracker.titlebg local numWatched = self:GetNumWatched() @@ -543,13 +566,15 @@ tracker.previousHeight = tracker.height if numBlocks >= 1 then previousBlock = nil - + if tracker.isEmpty then + tracker.headerFade:Play() + tracker.isEmpty = nil + end tracker.height = trackerHeight tracker:SetHeight(tracker.height) tracker:Show() - - else + tracker.isEmpty = true tracker.height = 0 tracker:Hide() end