Mercurial > wow > buffalo2
comparison ObjectiveFrame.lua @ 2:a2396b03ce63
- identify action buttons by the associated QuestID instead of QuestLogIndex
- deferred button placement in general to a self-destructing OnUpdate
-- and defer self-destruct to a end of combat event if InCombatLockdown
- tracker wrapper has an experience/reputation bar; the two elements "feel" related and it's a very simple info display
| author | Nenue |
|---|---|
| date | Thu, 31 Mar 2016 01:38:47 -0400 |
| parents | b0447b382f36 |
| children | 3397aae1f44d |
comparison
equal
deleted
inserted
replaced
| 1:b0447b382f36 | 2:a2396b03ce63 |
|---|---|
| 2 -- @file-author@ | 2 -- @file-author@ |
| 3 -- @project-revision@ @project-hash@ | 3 -- @project-revision@ @project-hash@ |
| 4 -- @file-revision@ @file-hash@ | 4 -- @file-revision@ @file-hash@ |
| 5 -- Created: 3/30/2016 12:49 AM | 5 -- Created: 3/30/2016 12:49 AM |
| 6 local B = select(2,...).frame | 6 local B = select(2,...).frame |
| 7 local ipairs, max, unpack = ipairs, max, unpack | 7 local ipairs, max, min, unpack, floor, pairs, tostring, type = ipairs, max, min, unpack, floor, pairs, tostring, type |
| 8 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion | |
| 9 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent | |
| 8 local CreateFrame = CreateFrame | 10 local CreateFrame = CreateFrame |
| 9 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') | 11 local mod = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') |
| 10 local print = B.print('Objectives') | 12 local print = B.print('Objectives') |
| 11 -------------------------------------------------------------------- | 13 -------------------------------------------------------------------- |
| 12 --- Global frame layout | 14 --- Global frame layout |
| 13 -------------------------------------------------------------------- | 15 -------------------------------------------------------------------- |
| 14 | 16 |
| 15 --- Upvalues | 17 --- Upvalues |
| 16 local Wrapper = _G.VeneerObjectiveWrapper | 18 local Wrapper = VeneerObjectiveWrapper |
| 17 local Scroller = Wrapper.scrollArea | 19 local Scroller = Wrapper.scrollArea |
| 18 local Scroll = _G.VeneerObjectiveScroll | 20 local Scroll = VeneerObjectiveScroll |
| 19 local orderedHandlers = mod.orderedHandlers | 21 local orderedHandlers = mod.orderedHandlers |
| 20 local orderedNames = mod.orderedNames | 22 local orderedNames = mod.orderedNames |
| 21 | 23 |
| 22 --- Temp values set during updates | 24 --- Temp values set during updates |
| 23 local wrapperWidth, wrapperHeight | 25 local wrapperWidth, wrapperHeight |
| 29 local titleSize, textSize = 15, 15 | 31 local titleSize, textSize = 15, 15 |
| 30 local titleOutline, textOutline = "OUTLINE", "OUTLINE" | 32 local titleOutline, textOutline = "OUTLINE", "OUTLINE" |
| 31 local titleSpacing, textSpacing = 4, 3 | 33 local titleSpacing, textSpacing = 4, 3 |
| 32 local textIndent = 5 | 34 local textIndent = 5 |
| 33 local wrapperMaxWidth, wrapperMaxHeight = 280, 490 -- these are the hard bounds, actual *Height variables are changed | 35 local wrapperMaxWidth, wrapperMaxHeight = 280, 490 -- these are the hard bounds, actual *Height variables are changed |
| 36 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' | |
| 34 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 | 37 local headerFont, headerSize, headerHeight = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 18, 24 |
| 35 local headerOutline, headerColor = 'OUTLINE', {1,1,1,1} | 38 local headerOutline, headerColor, headerSpacing = 'OUTLINE', {1,1,1,1}, 2 |
| 36 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0} | 39 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0} |
| 37 | 40 |
| 38 local Scroller_OnShow = function() | 41 --- These are mostly aesthetic choices so it lives here |
| 39 Wrapper.watchMoneyReasons = 0; | |
| 40 mod.UpdateWrapper() | |
| 41 end | |
| 42 | |
| 43 local Scroller_OnHide = function() | |
| 44 local self = Wrapper | |
| 45 Wrapper:UnregisterAllEvents() | |
| 46 Wrapper:SetScript('OnEvent', nil) | |
| 47 Wrapper.Background:Hide() | |
| 48 Wrapper.BackgroundR:Hide() | |
| 49 end | |
| 50 | |
| 51 local Scroller_OnMouseWheel = function(self, delta) | |
| 52 local r = Scroll:GetHeight() - Scroller:GetHeight() | |
| 53 local s = self:GetVerticalScroll() - delta * floor(r/5+.5) | |
| 54 if r == 0 then return end | |
| 55 if s >= r then | |
| 56 s = r | |
| 57 elseif s < 1 then | |
| 58 s = 0 | |
| 59 end | |
| 60 self:SetVerticalScroll(s) | |
| 61 print(s, r, self:GetVerticalScroll()) | |
| 62 | |
| 63 mod.UpdateActionButtons() | |
| 64 end | |
| 65 | |
| 66 local WrapperCloseButton_OnClick = function(self) | |
| 67 if Scroller:IsVisible() then | |
| 68 Scroller:Hide() | |
| 69 else | |
| 70 Scroller:Show() | |
| 71 end | |
| 72 end | |
| 73 | |
| 74 | |
| 75 mod.InitializeTrackers = function() | |
| 76 for i, name in ipairs(orderedNames) do | |
| 77 if not mod.orderedHandlers[i] then | |
| 78 if mod.Tracker(name, i) then | |
| 79 local handler = mod[name] | |
| 80 | |
| 81 local tracker = CreateFrame('Frame', 'Veneer'..name..'Tracker', Scroll, 'VeneerTrackerTemplate') | |
| 82 tracker.header:SetText(handler.name) | |
| 83 tracker.header:SetHeight(headerHeight) | |
| 84 tracker.header:SetFont(headerFont, headerSize, headerOutline) | |
| 85 tracker.header:SetTextColor(unpack(headerColor)) | |
| 86 | |
| 87 handler.Tracker = tracker | |
| 88 mod.orderedTrackers[i] = tracker | |
| 89 mod.namedTrackers[name] = tracker | |
| 90 mod.indexedTrackers[handler] = tracker | |
| 91 print('created new tracker frames for new handler') | |
| 92 end | |
| 93 end | |
| 94 end | |
| 95 | |
| 96 Scroller:SetScrollChild(Scroll) | |
| 97 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel) | |
| 98 Scroller:SetScript('OnShow', Scroller_OnShow) | |
| 99 Scroller:SetScript('OnHide', Scroller_OnHide) | |
| 100 Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick) | |
| 101 Wrapper:SetPoint(unpack(wrapperPosition)) | |
| 102 Scroller_OnShow(Scroller) | |
| 103 end | |
| 104 | |
| 105 mod.defaults = { | 42 mod.defaults = { |
| 106 ObjectiveTrackerAnchor = {'BOTTOM', 'RIGHT'}, | 43 ObjectiveTrackerAnchor = {'BOTTOM', 'RIGHT'}, |
| 107 ObjectiveTrackerParent = 'DebuffButton', | 44 ObjectiveTrackerParent = 'DebuffButton', |
| 108 ObjectiveTrackerSize = {250, 600}, | 45 ObjectiveTrackerSize = {250, 600}, |
| 109 ObjectiveWrapperParent = '', | 46 ObjectiveWrapperParent = '', |
| 47 WrapperStyle = { | |
| 48 Header = { | |
| 49 Background = {Left = [[Objective-Header]], Right = [[Objective-Header]], Tile = [[Objective-Header]]}, | |
| 50 BackgroundCrop = {Left = {0, 0.4, 0,1}, Right={0.6,1,0,1}, Tile = {0.4,.6,0,1,}}, | |
| 51 BackgroundScale = {Left = 100, Right = 100}, | |
| 52 Font = {wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline} | |
| 53 } | |
| 54 }, | |
| 55 ObjectiveHeaderStyle = { | |
| 56 Normal = { | |
| 57 Gradient = {MinColor = {0,0,0,0.5}, MaxColor = {0,0,0,1}}, | |
| 58 Font = {headerFont, headerSize, headerOutline}, Spacing = headerSpacing, | |
| 59 } | |
| 60 }, | |
| 110 ObjectiveTrackerStyle = { | 61 ObjectiveTrackerStyle = { |
| 111 Normal = { | 62 Normal = { |
| 112 Title = { | 63 Title = { |
| 113 Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, 0}}, | 64 Gradient = { MinColor = {0.2, .4, 1, 0.45}, MaxColor = {.7, 0, 0.9, 0}}, |
| 114 Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, | 65 Font = {titleFont, titleSize, titleOutline}, Spacing = titleSpacing, |
| 156 } | 107 } |
| 157 }, | 108 }, |
| 158 } | 109 } |
| 159 } | 110 } |
| 160 | 111 |
| 112 local Scroller_OnShow = function() | |
| 113 Wrapper.watchMoneyReasons = 0; | |
| 114 mod.UpdateWrapper() | |
| 115 mod.SetEvents() | |
| 116 for i, region in ipairs(Wrapper.header) do | |
| 117 region:Show() | |
| 118 end | |
| 119 end | |
| 120 | |
| 121 local Scroller_OnHide = function() | |
| 122 local self = Wrapper | |
| 123 Wrapper:UnregisterAllEvents() | |
| 124 Wrapper:SetScript('OnEvent', nil) | |
| 125 for i, region in ipairs(Wrapper.header) do | |
| 126 region:Hide() | |
| 127 end | |
| 128 end | |
| 129 | |
| 130 local Scroller_OnMouseWheel = function(self, delta) | |
| 131 local r = Scroll:GetHeight() - Scroller:GetHeight() | |
| 132 local s = self:GetVerticalScroll() - delta * floor(r/5+.5) | |
| 133 if r == 0 then return end | |
| 134 if s >= r then | |
| 135 s = r | |
| 136 elseif s < 1 then | |
| 137 s = 0 | |
| 138 end | |
| 139 self:SetVerticalScroll(s) | |
| 140 print(s, r, self:GetVerticalScroll()) | |
| 141 | |
| 142 mod.UpdateActionButtons() | |
| 143 end | |
| 144 | |
| 145 local WrapperCloseButton_OnClick = function(self) | |
| 146 if Scroller:IsVisible() then | |
| 147 Scroller:Hide() | |
| 148 else | |
| 149 Scroller:Show() | |
| 150 end | |
| 151 end | |
| 152 | |
| 153 mod.InitializeTrackers = function() | |
| 154 | |
| 155 local c = mod.defaults.ObjectiveHeaderStyle.Normal | |
| 156 local g1, g2, g3, g4 = unpack(c.Gradient.MinColor) | |
| 157 local h1, h2, h3, h4 = unpack(c.Gradient.MaxColor) | |
| 158 | |
| 159 for i, name in ipairs(orderedNames) do | |
| 160 if not mod.orderedHandlers[i] then | |
| 161 if mod.Tracker(name, i) then | |
| 162 local handler = mod[name] | |
| 163 | |
| 164 local tracker = CreateFrame('Frame', 'Veneer'..name..'Tracker', Scroll, 'VeneerTrackerTemplate') | |
| 165 tracker.header:SetText(handler.name) | |
| 166 tracker.header:SetHeight(headerHeight) | |
| 167 tracker.header:SetFont(unpack(c.Font)) | |
| 168 tracker.header:SetTextColor(unpack(headerColor)) | |
| 169 | |
| 170 tracker.headerbg:SetGradientAlpha('HORIZONTAL', g1, g2 ,g3, g4, h1, h2, h3, h4) | |
| 171 tracker.headerbg:SetHeight(headerHeight) | |
| 172 | |
| 173 handler.Tracker = tracker | |
| 174 mod.orderedTrackers[i] = tracker | |
| 175 mod.namedTrackers[name] = tracker | |
| 176 mod.indexedTrackers[handler] = tracker | |
| 177 print('created new tracker frames for new handler') | |
| 178 end | |
| 179 end | |
| 180 end | |
| 181 | |
| 182 Scroller:SetScrollChild(Scroll) | |
| 183 Scroller:SetScript('OnMouseWheel', Scroller_OnMouseWheel) | |
| 184 Scroller:SetScript('OnShow', Scroller_OnShow) | |
| 185 Scroller:SetScript('OnHide', Scroller_OnHide) | |
| 186 Wrapper.close:SetScript('OnClick', WrapperCloseButton_OnClick) | |
| 187 Wrapper:SetPoint(unpack(wrapperPosition)) | |
| 188 Scroller_OnShow(Scroller) | |
| 189 | |
| 190 mod.UpdateWrapperStyle() | |
| 191 end | |
| 192 | |
| 193 mod.InitializeXPTracker = function() | |
| 194 local XPBar = Wrapper.XPBar | |
| 195 if UnitLevel('player') == 100 then | |
| 196 XPBar:Hide() | |
| 197 return | |
| 198 end | |
| 199 | |
| 200 --- xp bar | |
| 201 XPBar:Show() | |
| 202 XPBar.rested:SetTexture(2,.6,1,1) | |
| 203 XPBar.fg:SetTexture(.3,.1,.95,1) | |
| 204 XPBar.bg:SetTexture(0,0,0,.25) | |
| 205 XPBar:RegisterEvent('PLAYER_XP_UPDATE') | |
| 206 XPBar:RegisterEvent('PLAYER_LEVEL_UP') | |
| 207 XPBar:RegisterEvent('PLAYER_UPDATE_RESTING') | |
| 208 XPBar:SetScript('OnEvent', mod.UpdateXP) | |
| 209 mod.UpdateXP(Wrapper.xpBar) | |
| 210 end | |
| 211 | |
| 212 mod.UpdateXP = function() | |
| 213 local XPBar = Wrapper.XPBar | |
| 214 local xp = UnitXP('player') | |
| 215 local xpmax = UnitXPMax('player') | |
| 216 local rest = GetXPExhaustion() | |
| 217 | |
| 218 XPBar.bg:SetAllPoints(XPBar) | |
| 219 XPBar.fg:SetWidth((xp/xpmax) * XPBar:GetWidth()) | |
| 220 | |
| 221 if IsResting() then | |
| 222 XPBar.bg:SetTexture(.2,.8,.2,.5) | |
| 223 else | |
| 224 XPBar.bg:SetTexture(0,0,0,.25) | |
| 225 end | |
| 226 | |
| 227 if rest then | |
| 228 XPBar.rested:ClearAllPoints() | |
| 229 if xp == 0 then | |
| 230 XPBar.rested:SetPoint('LEFT', XPBar, 'LEFT', 0, 0) | |
| 231 else | |
| 232 XPBar.rested:SetPoint('LEFT', XPBar.fg, 'RIGHT', 0, 0) | |
| 233 end | |
| 234 | |
| 235 if (xp + rest) > xpmax then | |
| 236 XPBar.rested:SetPoint('RIGHT', XPBar, 'RIGHT', 0, 0) | |
| 237 else | |
| 238 XPBar.rested:SetWidth((xp/xpmax) * XPBar:GetWidth()) | |
| 239 end | |
| 240 XPBar.rested:Show() | |
| 241 else | |
| 242 XPBar.rested:Hide() | |
| 243 end | |
| 244 | |
| 245 XPBar.xpText:SetText(xp .. '/'.. xpmax .. (rest and (' ('..tostring(rest)..')') or '')) | |
| 246 end | |
| 247 | |
| 248 mod.UpdateReputation = function(self) | |
| 249 end | |
| 161 | 250 |
| 162 --- Argument containers | 251 --- Argument containers |
| 163 local a1, a2, a3, a4, b1, b2, b3, b4, f1, f2, f3, w1, w2 | 252 local a1, a2, a3, a4, b1, b2, b3, b4, f1, f2, f3, w1, w2 |
| 164 mod.SetBlockStyle = function(block, name) | 253 mod.SetBlockStyle = function(block, name) |
| 165 -- var names intended to reflect argument order | 254 -- var names intended to reflect argument order |
| 255 --@debug@ | |
| 166 local c = mod.defaults.ObjectiveTrackerStyle[name] | 256 local c = mod.defaults.ObjectiveTrackerStyle[name] |
| 257 --@end-debug@ | |
| 258 --[===[@non-debug | |
| 259 local c = mod.Conf | |
| 260 --@end-non-debug]===] | |
| 167 a1, a2, a3, a4 = unpack(c.Title.Gradient.MinColor) | 261 a1, a2, a3, a4 = unpack(c.Title.Gradient.MinColor) |
| 168 b1, b2, b3, b4 = unpack(c.Title.Gradient.MaxColor) | 262 b1, b2, b3, b4 = unpack(c.Title.Gradient.MaxColor) |
| 169 block.titlebg:SetGradientAlpha('HORIZONTAL', a1, a2, a3, a4, b1, b2, b3, b4) | 263 block.titlebg:SetGradientAlpha('HORIZONTAL', a1, a2, a3, a4, b1, b2, b3, b4) |
| 170 | 264 |
| 171 a1, a2, a3, a4 = unpack(c.Text.Gradient.MinColor) | 265 a1, a2, a3, a4 = unpack(c.Text.Gradient.MinColor) |
| 210 block.titleHeight = titleHeight | 304 block.titleHeight = titleHeight |
| 211 block.textHeight = textHeight | 305 block.textHeight = textHeight |
| 212 block.width = blockWidth | 306 block.width = blockWidth |
| 213 block.height = blockHeight | 307 block.height = blockHeight |
| 214 | 308 |
| 215 print('|cFF88DDFFApplyStyle(', block:GetName(), ')|r', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')') | 309 print(' |cFF00FFFF'..block:GetName()..'|r:|cFF0088FFSetStyle|r(', blockWidth, 'x', blockHeight, '(textH', textHeight,', titleH', titleHeight, ')') |
| 310 end | |
| 311 | |
| 312 local segments = {'Left', 'Right', 'Tile'} | |
| 313 mod.UpdateWrapperStyle = function() | |
| 314 local c = mod.defaults.WrapperStyle | |
| 315 for _, segment in ipairs(segments) do | |
| 316 Wrapper['Background'..segment]:SetAtlas(c.Header.Background[segment]) | |
| 317 Wrapper['Background'..segment]:SetTexCoord(unpack(c.Header.BackgroundCrop[segment])) | |
| 318 if c.Header.BackgroundScale[segment] then | |
| 319 Wrapper['Background'..segment]:SetWidth(c.Header.BackgroundScale[segment]) | |
| 320 end | |
| 321 end | |
| 216 end | 322 end |
| 217 | 323 |
| 218 --- Updates the selected block frame to display the given info batch | 324 --- Updates the selected block frame to display the given info batch |
| 219 -- If `previousBlock` is set, it will attempt to anchor to that | 325 -- If `previousBlock` is set, it will attempt to anchor to that |
| 220 -- @param blockNum the ordered block to be updated, not a watchIndex value | 326 -- @param blockNum the ordered block to be updated, not a watchIndex value |
| 221 -- @param info the reference returned by the GetXInfo functions | 327 -- @param info the reference returned by the GetXInfo functions |
| 222 -- REMEMBER: t.info and questData[questID] are the same table | 328 -- REMEMBER: t.info and questData[questID] are the same table |
| 223 mod.UpdateTrackerBlock = function (handler, blockIndex, info) | 329 mod.UpdateTrackerBlock = function (handler, blockIndex, info) |
| 224 print('|cFF00FFFFUpdateTrackerBlock('..blockIndex..'|r') | 330 print(' |cFF00FFFFUpdateTrackerBlock('..blockIndex..'|r') |
| 225 if not blockIndex or not info then | 331 if not blockIndex or not info then |
| 226 return | 332 return |
| 227 end | 333 end |
| 228 | 334 |
| 229 local tracker = handler.Tracker | 335 local tracker = handler.Tracker |
| 235 else | 341 else |
| 236 t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0) | 342 t:SetPoint('TOPLEFT', previousBlock, 'BOTTOMLEFT', 0, 0) |
| 237 end | 343 end |
| 238 t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) | 344 t:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) |
| 239 end | 345 end |
| 240 print(t:GetName(), t:GetSize()) | 346 --print(t:GetName(), t:GetSize()) |
| 241 print(t:GetPoint(1)) | 347 --print(t:GetPoint(1)) |
| 242 | 348 |
| 243 t.info = info | 349 t.info = info |
| 244 | 350 |
| 245 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end | 351 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = t end |
| 246 if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end | 352 if info.watchIndex then handler.WatchBlock[info.watchIndex] = t end |
| 258 if info.isComplete then | 364 if info.isComplete then |
| 259 t.objectives:Show() | 365 t.objectives:Show() |
| 260 t.objectives:SetText(info.completionText) | 366 t.objectives:SetText(info.completionText) |
| 261 elseif info.numObjectives >= 1 then | 367 elseif info.numObjectives >= 1 then |
| 262 t.objectives:Show() | 368 t.objectives:Show() |
| 263 print('objective lines:', info.numObjectives, 'can wrap:', t.objectives:CanWordWrap()) | 369 print(' - objective lines:', info.numObjectives, 'can wrap:', t.objectives:CanWordWrap()) |
| 264 local text = '' | 370 local text = '' |
| 265 for o, obj in ipairs(t.info.objectives) do | 371 for o, obj in ipairs(t.info.objectives) do |
| 266 local line = obj.text | 372 local line = obj.text |
| 267 if obj.type == 'monster' then | 373 if obj.type == 'monster' then |
| 268 line = '|cFFFFFF00' .. line .. '|r' | 374 line = '|cFFFFFF00' .. line .. '|r' |
| 275 end | 381 end |
| 276 t.objectives:SetText(text) | 382 t.objectives:SetText(text) |
| 277 | 383 |
| 278 | 384 |
| 279 -- todo: set up a SecureActionButton template | 385 -- todo: set up a SecureActionButton template |
| 280 if info.specialItem then | 386 if info.specialItem and not info.itemButton then |
| 281 print('|cFF00FFFFretrieve item button') | 387 print(' - |cFF00FFFFupdate item button') |
| 282 mod.SetItemButton(t, info) | 388 mod.SetItemButton(t, info) |
| 283 elseif t.itemButton then | |
| 284 print('|cFF00FF88drop item button') | |
| 285 mod.FreeItemButton(t, info) | |
| 286 end | 389 end |
| 287 | 390 |
| 288 | 391 |
| 289 elseif info.description then | 392 elseif info.description then |
| 290 t.objectives:SetText(info.description) | 393 t.objectives:SetText(info.description) |
| 302 t:SetStyle(style) | 405 t:SetStyle(style) |
| 303 | 406 |
| 304 | 407 |
| 305 local fullheight = t:GetHeight() | 408 local fullheight = t:GetHeight() |
| 306 t:Show() | 409 t:Show() |
| 307 print('|cFF00FFFF)|r -> ', t, t:GetHeight(), fullheight) | 410 print(' |cFF00FFFF)|r -> ', t, t:GetHeight(), fullheight) |
| 308 return t | 411 return t |
| 309 end | 412 end |
| 310 | 413 |
| 311 mod.UpdateTracker = function(handler) | 414 mod.UpdateTracker = function(handler) |
| 312 print('|cFF00FF88UpdateTracker(|r|cFFFF4400' .. type(handler) .. '|r :: |cFF88FFFF' .. tostring(handler) .. '|r') | 415 print('|cFF00FF88UpdateTracker(|r|cFFFF4400' .. type(handler) .. '|r :: |cFF88FFFF' .. tostring(handler) .. '|r') |
| 324 if watchIndex <= numWatched then | 427 if watchIndex <= numWatched then |
| 325 local info = handler:GetInfo(watchIndex) | 428 local info = handler:GetInfo(watchIndex) |
| 326 if info then | 429 if info then |
| 327 local currentBlock = mod.UpdateTrackerBlock(handler, blockIndex, info) | 430 local currentBlock = mod.UpdateTrackerBlock(handler, blockIndex, info) |
| 328 previousBlock = currentBlock | 431 previousBlock = currentBlock |
| 329 print('adding ', currentBlock.height) | |
| 330 trackerHeight = trackerHeight + currentBlock.height | 432 trackerHeight = trackerHeight + currentBlock.height |
| 331 numBlocks = max(numBlocks, watchIndex) | 433 numBlocks = max(numBlocks, watchIndex) |
| 332 actualBlocks = actualBlocks + 1 | 434 actualBlocks = actualBlocks + 1 |
| 333 else | 435 else |
| 334 print('|cFFFF0000Failed to draw info for index #'..watchIndex) | 436 print('|cFFFF0000Failed to draw info for index #'..watchIndex) |
| 410 wrapperWidth = floor(wrapperWidth+.5) | 512 wrapperWidth = floor(wrapperWidth+.5) |
| 411 wrapperHeight = floor(wrapperHeight+.5) | 513 wrapperHeight = floor(wrapperHeight+.5) |
| 412 headerHeight = floor(headerHeight+.5) | 514 headerHeight = floor(headerHeight+.5) |
| 413 | 515 |
| 414 if wrapperBlocks >= 1 then | 516 if wrapperBlocks >= 1 then |
| 415 Wrapper.Background:Show() | 517 for i, region in ipairs(Wrapper.header) do |
| 416 Wrapper.BackgroundR:Show() | 518 region:Show() |
| 417 else | 519 end |
| 418 Wrapper.Background:Hide() | 520 else |
| 419 Wrapper.BackgroundR:Hide() | 521 for i, region in ipairs(Wrapper.header) do |
| 522 region:Hide() | |
| 523 end | |
| 420 return | 524 return |
| 421 end | 525 end |
| 422 --wrapperHeight = scrollHeight | 526 --wrapperHeight = scrollHeight |
| 423 | 527 |
| 424 print('|cFFFFFF00params:|r scroller:', scrollWidth, 'x', scrollHeight) | 528 print('|cFFFFFF00params:|r scroller:', scrollWidth, 'x', scrollHeight) |
| 450 end | 554 end |
| 451 | 555 |
| 452 --- Queue any active item buttons for update for that frame | 556 --- Queue any active item buttons for update for that frame |
| 453 mod.UpdateActionButtons = function() | 557 mod.UpdateActionButtons = function() |
| 454 local previousItem | 558 local previousItem |
| 455 for questIndex, itemButton in pairs(usedButtons) do | 559 for questID, itemButton in pairs(usedButtons) do |
| 560 local questIndex = mod.Quest.Info[questID].questLogIndex | |
| 456 print('|cFF00FFFF', questIndex, itemButton:GetName()) | 561 print('|cFF00FFFF', questIndex, itemButton:GetName()) |
| 457 local block = mod.Quest.LogBlock[questIndex] | 562 local block = mod.Quest.LogBlock[questIndex] |
| 458 print(block:GetTop()) | 563 print(block:GetTop()) |
| 459 if block then | 564 if block then |
| 460 if IsQuestWatched(questIndex) then | 565 if IsQuestWatched(questIndex) then |
| 467 block:SetScript('OnUpdate', nil) | 572 block:SetScript('OnUpdate', nil) |
| 468 end | 573 end |
| 469 end) | 574 end) |
| 470 return | 575 return |
| 471 else | 576 else |
| 472 mod.FreeItemButton(block, itemButton) | 577 mod.FreeItemButtons(block) |
| 473 end | 578 end |
| 474 end | 579 end |
| 475 end | 580 end |
| 476 end | 581 end |
| 477 | 582 |
| 478 mod.UpdateBlockAction = function (block, itemButton, previousItem) | 583 mod.UpdateBlockAction = function (block, itemButton, previousItem) |
| 584 if block.itemButton ~= itemButton then | |
| 585 block.itemButton = itemButton | |
| 586 end | |
| 587 if itemButton.block ~= block then | |
| 588 itemButton.block = block | |
| 589 end | |
| 590 | |
| 479 if block:GetBottom() < Scroller:GetBottom() then | 591 if block:GetBottom() < Scroller:GetBottom() then |
| 480 print('|cFFFFFF00bottom not fully visible') | 592 print('|cFFFFFF00bottom not fully visible') |
| 481 if previousItem then | 593 if previousItem then |
| 482 previousItem:ClearAllPoints() | 594 previousItem:ClearAllPoints() |
| 483 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, 4) | 595 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, 4) |
