annotate ObjectiveTracker/ObjectiveFrame.lua @ 37:e84d645c8ab8

- revised the tracker update function to build its complete data list up front and use the values as points of comparison for determining possible out of place blocks, which will be iterated over afterward to remove what wasn't re-used - also entailed revising the exact role of global event handlers and function hooks, limiting their directions of communication so one doesn't end up calling the other multiple or inifinity times - schema handling polish
author Nenue
date Mon, 18 Apr 2016 07:56:23 -0400
parents 4b3da1b221de
children
rev   line source
Nenue@1 1 --- ${PACKAGE_NAME}
Nenue@1 2 -- @file-author@
Nenue@1 3 -- @project-revision@ @project-hash@
Nenue@1 4 -- @file-revision@ @file-hash@
Nenue@1 5 -- Created: 3/30/2016 12:49 AM
Nenue@1 6 local B = select(2,...).frame
Nenue@23 7 local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame')
Nenue@23 8 local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band
Nenue@2 9 local IsResting, UnitXP, UnitXPMax, GetXPExhaustion = IsResting, UnitXP, UnitXPMax, GetXPExhaustion
Nenue@2 10 local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent
Nenue@23 11 local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText
Nenue@23 12 local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent
Nenue@23 13 local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs
Nenue@23 14 local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame
Nenue@21 15 local print = B.print('Tracker')
Nenue@13 16 local unitLevel = 1
Nenue@19 17 local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON
Nenue@21 18 local debug = false
Nenue@1 19 --------------------------------------------------------------------
Nenue@1 20 --- Global frame layout
Nenue@1 21 --------------------------------------------------------------------
Nenue@1 22
Nenue@1 23 --- Upvalues
Nenue@23 24 local Wrapper = _G.VeneerObjectiveWrapper
Nenue@1 25 local Scroller = Wrapper.scrollArea
Nenue@23 26 local Scroll = _G.VeneerObjectiveScroll
Nenue@23 27 local orderedHandlers = T.orderedHandlers
Nenue@23 28 local orderedNames = T.orderedNames
Nenue@1 29
Nenue@1 30 --- Temp values set during updates
Nenue@1 31 local wrapperWidth, wrapperHeight
Nenue@1 32 local scrollWidth, scrollHeight
Nenue@1 33 local previousBlock
Nenue@1 34 local currentBlock
Nenue@10 35 --- todo: source these from config
Nenue@6 36 local itemButtonSize, itemButtonSpacing = 36, 1
Nenue@25 37
Nenue@25 38 local headerHeight, headerColor, headerSpacing = 16, {1,1,1,1}, 2
Nenue@25 39 local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0}
Nenue@25 40 local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE'
Nenue@25 41
Nenue@25 42 local titlebg = {'HORIZONTAL', 1, 0, .7, .25, 1, 0, .7, .125}
Nenue@25 43 local titlebg_daily = {'HORIZONTAL', 0, .7, 1, .25, 0, 1, .7, .125 }
Nenue@25 44 local titlebg_account = {'HORIZONTAL', 0, .45, 1, .25, 0, .45, 1, .125}
Nenue@25 45 local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE'
Nenue@25 46
Nenue@25 47 local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 }
Nenue@25 48 local textbg_daily = {'HORIZONTAL', 0, .7, 1, .1, 0, 1, .7, .075 }
Nenue@25 49 local textbg_account = {'HORIZONTAL', 0, .45, 1, 0.4, 0, .41, 1, .085 }
Nenue@25 50 local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE'
Nenue@25 51
Nenue@25 52
Nenue@23 53 local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225}
Nenue@23 54 local titleSpacing, textSpacing, blockSpacing = 3, 3, 1
Nenue@23 55 local titleIndent, textIndent,selectionIndent = 2, 5, 50
Nenue@25 56
Nenue@12 57 local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed
Nenue@2 58 local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE'
Nenue@22 59 local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 }
Nenue@22 60 local rewardSize = 32
Nenue@21 61 local oprint = B.print('Objectives')
Nenue@21 62 local bprint = B.print('Block')
Nenue@21 63 local tprint = B.print('Tracker')
Nenue@21 64 local lprint = B.print('Line')
Nenue@1 65
Nenue@19 66 local currentPosition, anchorFrame, anchorPoint
Nenue@3 67
Nenue@24 68
Nenue@23 69
Nenue@23 70 T.AddBlock = function(handler, block)
Nenue@23 71 local print = bprint
Nenue@23 72 end
Nenue@23 73
Nenue@23 74 --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons)
Nenue@23 75 T.AddTag = function (block, tagName, tagPoint, tagAnchor, tagRelative)
Nenue@23 76 local print = bprint
Nenue@23 77 local tag = block[tagName]
Nenue@23 78 if block.info[tagName] and tag then
Nenue@23 79 tag:SetTexCoord(unpack(block.info[tagName]))
Nenue@23 80 tag:Show()
Nenue@23 81 tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0)
Nenue@23 82 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT'
Nenue@23 83 else
Nenue@23 84 block[tagName]:Hide()
Nenue@23 85 end
Nenue@23 86 return tagPoint, tagAnchor, tagRelative
Nenue@23 87 end
Nenue@23 88
Nenue@23 89 --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call.
Nenue@23 90 T.AddLine = function(block, line)
Nenue@21 91 local print = lprint
Nenue@23 92 line:ClearAllPoints()
Nenue@23 93 line:SetPoint('LEFT', block, 'LEFT', 0, 0)
Nenue@23 94 line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing)
Nenue@23 95 line:SetPoint('RIGHT', block, 'RIGHT', 0, 0)
Nenue@23 96 line:SetHeight(line.height)
Nenue@23 97 line:Show()
Nenue@23 98
Nenue@23 99 block.endIndex = line.index
Nenue@23 100 block.numLines = block.numLines + 1
Nenue@23 101 block.attachmentHeight = block.attachmentHeight + (line.height + textSpacing)
Nenue@23 102 print(' |cFF0088FFsetting line #'..block.numLines..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height,
Nenue@23 103 "|cFF0088FFpoint:|r", line:GetPoint(1), "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N'))
Nenue@23 104 block.endPoint = line
Nenue@23 105 end
Nenue@23 106
Nenue@23 107 --- Creates or retrieves a complete line data object
Nenue@23 108 T.GetLine = function(handler, block, lineIndex)
Nenue@23 109 local print = lprint
Nenue@23 110 local blockIndex = block.index
Nenue@23 111 if not block.lines then
Nenue@23 112 block.lines = {}
Nenue@21 113 end
Nenue@23 114 local lines = block.lines
Nenue@21 115 if not lines[lineIndex] then
Nenue@23 116 print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex)
Nenue@23 117 lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective')
Nenue@21 118 local line = lines[lineIndex]
Nenue@21 119 line.index = lineIndex
Nenue@21 120 line.height = 0
Nenue@21 121 line.status:SetSpacing(textSpacing)
Nenue@21 122 line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0)
Nenue@21 123 B.SetConfigLayers(line)
Nenue@2 124
Nenue@21 125 if lines[lineIndex+1] then
Nenue@21 126 lines[lineIndex+1]:ClearAllPoints()
Nenue@19 127 end
Nenue@19 128
Nenue@21 129 if debug then
Nenue@21 130 for _, region in ipairs(lines[lineIndex].debug) do
Nenue@21 131 region:Show()
Nenue@21 132 end
Nenue@19 133 end
Nenue@19 134
Nenue@13 135 end
Nenue@21 136 return lines[lineIndex]
Nenue@2 137 end
Nenue@2 138
Nenue@23 139 --- Creates or retrieves a complete block frame object
Nenue@23 140 T.GetBlock = function(handler, blockIndex)
Nenue@21 141 local print = bprint
Nenue@19 142 local block = handler.usedBlocks[blockIndex]
Nenue@21 143
Nenue@19 144 if not handler.usedBlocks[blockIndex] then
Nenue@19 145 if #handler.freeBlocks >= 1 then
Nenue@19 146 block = handler.freeBlocks[#handler.freeBlocks]
Nenue@19 147 handler.freeBlocks[#handler.freeBlocks] = nil
Nenue@19 148 else
Nenue@19 149 block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, Scroll, 'VeneerTrackerBlock')
Nenue@21 150
Nenue@23 151
Nenue@23 152
Nenue@23 153 local c = T.Conf.Wrapper
Nenue@23 154 block.index = blockIndex
Nenue@23 155 block.SetStyle = T.SetBlockStyle
Nenue@21 156 block:SetWidth(c.Width)
Nenue@21 157
Nenue@21 158 block.title:SetSpacing(c.TitleSpacing)
Nenue@21 159 block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing)
Nenue@21 160
Nenue@21 161 block.titlebg:SetTexture(1,1,1,1)
Nenue@24 162 block.titlebg:SetGradientAlpha(unpack(T.colors.default.titlebg))
Nenue@21 163 block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0)
Nenue@21 164 block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing)
Nenue@21 165
Nenue@21 166 block.status:SetSpacing(c.TextSpacing)
Nenue@21 167 block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing)
Nenue@21 168 block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0)
Nenue@21 169
Nenue@21 170 block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0)
Nenue@21 171 block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0)
Nenue@21 172 block.statusbg:SetTexture(1,1,1,1)
Nenue@24 173 block.statusbg:SetGradientAlpha(unpack(T.colors.default.textbg))
Nenue@21 174
Nenue@24 175 block.SelectionOverlay:SetGradientAlpha(unpack(T.colors.default.selectionbg))
Nenue@23 176 block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0)
Nenue@21 177 block.SelectionOverlay:SetPoint('BOTTOMRIGHT')
Nenue@21 178
Nenue@22 179 block.icon:SetSize(rewardSize, rewardSize)
Nenue@22 180 block.icon:SetPoint('TOPRIGHT', block, 'TOPRIGHT', -2, -2)
Nenue@21 181
Nenue@21 182
Nenue@21 183 --- methods for event handlers
Nenue@21 184
Nenue@19 185 block.Select = handler.Select
Nenue@19 186 block.Open = handler.Open
Nenue@19 187 block.Remove = handler.Remove
Nenue@19 188 block.Link = handler.Link
Nenue@25 189 block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end)
Nenue@25 190 block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end)
Nenue@19 191 block.attachmentHeight = 0
Nenue@19 192 block:ClearAllPoints()
Nenue@21 193
Nenue@21 194 B.SetConfigLayers(block)
Nenue@21 195
Nenue@21 196 if debug then
Nenue@21 197 for _, region in ipairs(block.debug) do
Nenue@21 198 region:Show()
Nenue@21 199 end
Nenue@21 200 end
Nenue@19 201 end
Nenue@19 202 handler.usedBlocks[blockIndex] = block
Nenue@2 203 end
Nenue@19 204 return handler.usedBlocks[blockIndex]
Nenue@2 205 end
Nenue@2 206
Nenue@23 207 --- Module-specific data wrangling that has to happen during UpdateBlock()
Nenue@23 208 -- Most of this is sculpting objectives data into a parsible list.
Nenue@23 209 -- Some of it is additional block manipulation that doesn't quite fit with the other modules..
Nenue@23 210 Bonus.UpdateObjectives = function(handler, block)
Nenue@23 211 Default.UpdateObjectives(handler, block)
Nenue@21 212 end
Nenue@14 213
Nenue@23 214
Nenue@23 215 --- They are not exactly quests, but the aliases used to signal that a quest was pushed into your log by the environment.
Nenue@23 216 -- Once accepted they never appear again unless the quest is dropped (daily reset/abandon quest)
Nenue@23 217 local CLICK_TO_COMPLETE = 'Click to Complete'
Nenue@23 218 local CLICK_TO_ACCEPT = 'Click to Accept'
Nenue@23 219 AutoQuest.UpdateObjectives = function(handler, block)
Nenue@23 220 local print = lprint
Nenue@23 221 if block.info.type == 'OFFER' then
Nenue@23 222 block.status:SetText(CLICK_TO_ACCEPT)
Nenue@23 223 end
Nenue@23 224 end
Nenue@23 225
Nenue@23 226
Nenue@23 227
Nenue@23 228
Nenue@23 229 --- Does the main iterations for populating block content.
Nenue@23 230 -- Hooked by corresponding handler functions where additional details need to be sorted.
Nenue@21 231 Default.UpdateObjectives = function(handler, block)
Nenue@21 232 local print = lprint
Nenue@21 233 local info = block.info
Nenue@23 234 print(' |cFF00FF00default objectives routine', block:GetName())
Nenue@1 235
Nenue@23 236 -- reset the starting positions
Nenue@23 237 block.attachmentHeight = 0
Nenue@23 238 block.endPoint = block.titlebg
Nenue@21 239 local completionScore, completionMax = 0, 0
Nenue@21 240 local displayObjectiveHeader = false
Nenue@21 241
Nenue@21 242
Nenue@23 243 --- The first line is going to be used no matter what, so it is hard-pulled.
Nenue@23 244 -- It also ensures that we're in the right position for cleaning up the leftover lines.
Nenue@23 245 local lineIndex = 1
Nenue@23 246 local line = T.GetLine(handler, block, lineIndex)
Nenue@21 247
Nenue@23 248 block.numLines = 0
Nenue@23 249 block.attachmentHeight = 0
Nenue@25 250
Nenue@25 251 if info.description and #info.description >= 1 then
Nenue@25 252 print(' |cFF00FFFF header line:|r', info.description)
Nenue@25 253 line.status:SetText(info.description)
Nenue@25 254 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
Nenue@23 255 if line.widget then
Nenue@23 256 line.widget:Hide()
Nenue@23 257 end
Nenue@25 258 T.AddLine(block, line)
Nenue@25 259
Nenue@25 260 lineIndex = lineIndex + 1
Nenue@25 261 line = T.GetLine(handler, block, lineIndex)
Nenue@25 262 end
Nenue@25 263
Nenue@25 264 if (info.isComplete == true or info.isComplete == nil) and info.completionText then
Nenue@25 265 print(' overriding line #1 for completion text:', info.completionText)
Nenue@23 266 line.status:SetText(info.completionText)
Nenue@25 267 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing
Nenue@25 268 if line.widget then
Nenue@25 269 line.widget:Hide()
Nenue@25 270 end
Nenue@23 271 T.AddLine(block, line)
Nenue@23 272 else
Nenue@23 273 if info.objectives then
Nenue@23 274 for i, data in ipairs(info.objectives) do
Nenue@23 275 print(' |cFF88FF00#', i, data.type, data.text)
Nenue@23 276 displayObjectiveHeader = true
Nenue@23 277 line.height = 0
Nenue@23 278 handler:UpdateLine(block, line, data)
Nenue@22 279
Nenue@23 280 -- For progressbar and timer lines, status text may be used as the title heading
Nenue@23 281 if line.widget then
Nenue@23 282 local widgetPosition = 0
Nenue@23 283 --- WIDGET POSITION -------------------------------------------------
Nenue@23 284 line.widget:SetPoint('TOP', line, 'TOP', 0, -widgetPosition)
Nenue@23 285 line.widget:Show()
Nenue@23 286 line.height = line.widget:GetHeight() + textSpacing
Nenue@23 287 ---------------------------------------------------------------------
Nenue@23 288 if line.displayText and #line.displayText >= 1 then
Nenue@23 289 widgetPosition = line.status:GetHeight() + textSpacing
Nenue@23 290 line.status:SetText(line.displayText)
Nenue@23 291 line.height = floor(line.status:GetStringHeight()+.5) + textSpacing + line.widget.height
Nenue@23 292 print(' - progressbar has text, adjust')
Nenue@23 293 end
Nenue@23 294 elseif line.displayText then
Nenue@22 295 line.status:SetText(line.displayText)
Nenue@23 296 line.height = floor(line.status:GetStringHeight()+.5)
Nenue@22 297 end
Nenue@22 298
Nenue@23 299 T.AddLine(block, line)
Nenue@19 300
Nenue@23 301 --print(' sz', line:GetWidth(), line:GetHeight(), 'pt', line:GetPoint(1))
Nenue@23 302 --print(' |cFF44BBFF#', i, 'anchoring line, size:', line.height, 'current endpoint:', line.statusbg)
Nenue@19 303
Nenue@23 304 lineIndex = lineIndex + 1
Nenue@23 305 line = T.GetLine(handler, block, lineIndex)
Nenue@21 306 end
Nenue@14 307 end
Nenue@14 308 end
Nenue@14 309
Nenue@23 310 while (block.lines[lineIndex+1]) do
Nenue@23 311 print(' - hide |cFFFF0088'..lineIndex..'|r')
Nenue@23 312 block.lines[lineIndex]:Hide()
Nenue@23 313 lineIndex = lineIndex +1
Nenue@23 314 end
Nenue@19 315
Nenue@19 316
Nenue@23 317
Nenue@23 318 if lineIndex > 0 then
Nenue@23 319 block.attachmentHeight = block.attachmentHeight + textSpacing * 2
Nenue@23 320 print(' |cFF00FF00attachment:', block.attachmentHeight)
Nenue@23 321 end
Nenue@23 322
Nenue@23 323
Nenue@23 324 --[[
Nenue@23 325 local lines = handler.lines[block.index]
Nenue@23 326 if lines and #lines > block.numLines then
Nenue@23 327 print(' |cFFFF008' .. (#lines - block.numLines) .. ' extra lines to hide.')
Nenue@23 328 for i = block.numLines + 1, #lines do
Nenue@23 329 print(' hide', i, lines[i]:GetName())
Nenue@23 330 lines[i]:Hide()
Nenue@23 331 end
Nenue@23 332 end
Nenue@23 333 ]]
Nenue@23 334
Nenue@21 335
Nenue@21 336 if debug then
Nenue@21 337 for i, region in ipairs(block.debug) do
Nenue@21 338 for j = 1, region:GetNumPoints() do
Nenue@21 339 local _, target = region:GetPoint(j)
Nenue@21 340 if target:IsVisible() then
Nenue@21 341 region:Hide()
Nenue@21 342 else
Nenue@21 343 region:Show()
Nenue@21 344 end
Nenue@21 345 end
Nenue@21 346 end
Nenue@21 347 end
Nenue@21 348
Nenue@14 349 block.completionScore = completionScore / completionMax
Nenue@21 350 end
Nenue@14 351
Nenue@21 352
Nenue@21 353 --- Module-specific display variables
Nenue@14 354 -- * height - height of whatever display widget is involved in conveying the task
Nenue@14 355 -- * money - boolean that determines listening for money events or not
Nenue@14 356 -- * progress - number ranging 0 to 2 indicating none/partial/full completion respectively
Nenue@14 357
Nenue@21 358
Nenue@21 359
Nenue@21 360 Bonus.UpdateLine = function(handler, block, line, data)
Nenue@21 361 local info = block.info
Nenue@21 362 local print = lprint
Nenue@21 363
Nenue@21 364
Nenue@21 365 line.displayColor = 'FFFFFF'
Nenue@22 366 line.displayText = data.text
Nenue@21 367 line.progress = 0
Nenue@21 368 print(' ', data.objectiveIndex,'|cFFFF0088-|r', data.objectiveType, data.text)
Nenue@21 369 if data.objectiveType == 'progressbar' then
Nenue@21 370 line.widgetType = 'ProgressBar'
Nenue@21 371 print(' |cFFFF44DDpercent='..tostring(GetQuestProgressBarPercent(info.questID)))
Nenue@21 372 data.value = GetQuestProgressBarPercent(info.questID) or 0
Nenue@21 373 data.maxValue = 100
Nenue@21 374 if data.value >= data.maxValue then
Nenue@21 375 line.progress = 1
Nenue@21 376 elseif data.value > 0 then
Nenue@21 377 line.progress = 2
Nenue@21 378 end
Nenue@21 379 line.format = PERCENTAGE_STRING
Nenue@23 380 local widget = T.SetWidget(line, data, 'ProgressBar', info.questID..'-'..data.objectiveIndex)
Nenue@21 381 print(' |cFFFF0022** text:|r', data.text, '|cFFFF0022value:|r', data.value, '|cFFFF0022max:|r', data.maxValue)
Nenue@22 382 widget:SetPoint('TOP', line, 'TOP', 0, 0)
Nenue@21 383
Nenue@21 384 line.widget = widget
Nenue@21 385 line.height = widget.height
Nenue@21 386 else
Nenue@21 387 line.displayText = data.text
Nenue@21 388 line.widget = nil
Nenue@21 389 end
Nenue@21 390 return line
Nenue@21 391 end
Nenue@21 392
Nenue@21 393 Cheevs.UpdateLine = function(handler, block, line, data)
Nenue@21 394 local print = B.print('CheevsLine')
Nenue@21 395 line.progress = 0
Nenue@21 396 print(' ', data.objectiveIndex,'|cFF0088FF-|r', data.objectiveType, data.text)
Nenue@21 397 if data.flags then
Nenue@21 398 if band(data.flags, 0x00000001) > 0 then
Nenue@21 399 line.format = "%d/%d"
Nenue@23 400 line.widget = T.SetWidget(line, data, 'ProgressBar', data.criteriaID)
Nenue@21 401 line.height = line.widget.height
Nenue@21 402 elseif band(data.flags, 0x00000002) then
Nenue@21 403 line.widget = nil
Nenue@21 404 else
Nenue@21 405 line.widget = nil
Nenue@21 406 line.displayColor = 'FFFFFF'
Nenue@21 407 line.displayText = line.text
Nenue@21 408
Nenue@21 409 end
Nenue@21 410 else
Nenue@21 411
Nenue@21 412 line.displayText = data.text
Nenue@21 413 end
Nenue@21 414 print('line.type =', data.type)
Nenue@21 415 print(' ** qtyStr:', data.quantityString, 'qty:', data.quantity, 'assetID:', data.assetID)
Nenue@21 416 end
Nenue@21 417 Default.UpdateLine = function(block, line)
Nenue@14 418 if line.finished then
Nenue@14 419 line.progress = 2
Nenue@14 420 elseif line.quantity > 0 then
Nenue@14 421 line.progress = 1
Nenue@14 422 else
Nenue@14 423 line.progress = 0
Nenue@14 424 end
Nenue@21 425 return line
Nenue@14 426 end
Nenue@14 427
Nenue@14 428
Nenue@23 429 T.Quest.numButtons = 0
Nenue@23 430 local usedButtons = T.Quest.itemButtons
Nenue@23 431 local freeButtons = T.Quest.freeButtons
Nenue@19 432 --[=[
Nenue@23 433 T.UpdateWrapper = function(reason)
Nenue@16 434 print('|cFF00FFFFUpdateWrapper:|r', reason)
Nenue@13 435 unitLevel = UnitLevel('player')
Nenue@23 436 wrapperWidth = T.Conf.Wrapper.WrapperWidth
Nenue@23 437 scrollWidth = T.Conf.Wrapper.WrapperWidth
Nenue@1 438 local wrapperBlocks = 0
Nenue@1 439 -- Update scroll child vertical size
Nenue@1 440 scrollHeight = 0
Nenue@1 441 for i, handler in ipairs(orderedHandlers) do
Nenue@23 442 T.UpdateTracker(handler)
Nenue@19 443 local frame = handler.frame
Nenue@1 444 if handler.actualBlocks >= 1 then
Nenue@19 445 frame:SetParent(Scroll)
Nenue@19 446 frame:SetPoint('TOPLEFT', Scroll, 'TOPLEFT', 0, - scrollHeight)
Nenue@19 447 frame:SetSize(wrapperWidth, frame.height)
Nenue@19 448 print('|cFF00FFFF'..frame:GetName()..'|r h:|cFF00FF00', frame.height, '|r y:|cFF00FF00', -scrollHeight)
Nenue@19 449 scrollHeight = scrollHeight + frame.height
Nenue@19 450 frame:Show()
Nenue@14 451 else
Nenue@19 452 frame:Hide()
Nenue@1 453 end
Nenue@1 454 wrapperBlocks = wrapperBlocks + handler.actualBlocks
Nenue@1 455 end
Nenue@1 456 print('final scrollHeight:', scrollHeight)
Nenue@1 457
Nenue@1 458
Nenue@1 459
Nenue@1 460 -- Update frame dimensions
Nenue@1 461 if scrollHeight > wrapperMaxHeight then
Nenue@1 462 print(' is larger than', wrapperMaxHeight)
Nenue@1 463 wrapperHeight = wrapperMaxHeight
Nenue@1 464 else
Nenue@1 465 wrapperHeight = scrollHeight
Nenue@9 466 B.Conf.ObjectiveScroll = 0
Nenue@1 467 end
Nenue@1 468 scrollWidth = floor(scrollWidth+.5)
Nenue@1 469 scrollHeight = floor(scrollHeight+.5)
Nenue@1 470 wrapperWidth = floor(wrapperWidth+.5)
Nenue@1 471 wrapperHeight = floor(wrapperHeight+.5)
Nenue@1 472 headerHeight = floor(headerHeight+.5)
Nenue@1 473
Nenue@1 474 if wrapperBlocks >= 1 then
Nenue@10 475 for i, region in ipairs(Wrapper.headerComplex) do
Nenue@2 476 region:Show()
Nenue@2 477 end
Nenue@1 478 else
Nenue@10 479 for i, region in ipairs(Wrapper.headerComplex) do
Nenue@2 480 region:Hide()
Nenue@2 481 end
Nenue@1 482 return
Nenue@1 483 end
Nenue@14 484 --[[wrapperHeight = scrollHeight
Nenue@1 485
Nenue@14 486 print('|cFFFFFF00params:|r scroller:', scrollWidth .. ',' .. scrollHeight, 'scroll:', scrollWidth .. ',' .. scrollHeight,
Nenue@14 487 'wrapper:', wrapperWidth .. ',' .. wrapperHeight,
Nenue@14 488 'header:', headerHeight)]]
Nenue@1 489
Nenue@14 490 --Scroller:SetSize(wrapperWidth, wrapperHeight)
Nenue@13 491 Scroller:SetPoint('TOPLEFT', Wrapper, 'TOPLEFT', 0, 0)
Nenue@1 492 Scroller:SetPoint('BOTTOMRIGHT', Wrapper, 'BOTTOMRIGHT')
Nenue@1 493
Nenue@7 494
Nenue@1 495 Scroll:SetSize(scrollWidth, scrollHeight)
Nenue@7 496 Scroll:SetPoint('TOPLEFT', Scroller, 'TOPLEFT', 0, B.Conf.ObjectiveScroll or 0)
Nenue@1 497 Scroll:SetPoint('RIGHT', Scroller, 'RIGHT')
Nenue@1 498
Nenue@1 499 --Scroller:UpdateScrollChildRect()
Nenue@13 500 Wrapper:SetSize(wrapperWidth, wrapperHeight)
Nenue@1 501
Nenue@14 502 --[[ update action buttons
Nenue@6 503 print('|cFF00FF00'..Scroll:GetName()..'|r:', Scroll:GetWidth(), Scroll:GetHeight(),
Nenue@6 504 '|cFF00FF00'..Scroller:GetName()..'|r:', Scroller:GetWidth(), Scroller:GetHeight(),
Nenue@6 505 '|cFF00FF00'..Wrapper:GetName()..'|r:', Wrapper:GetWidth(), Wrapper:GetHeight(),
Nenue@6 506 '|cFF0088FFvScrollRange|r:', floor(Scroller:GetVerticalScrollRange()+.5)
Nenue@6 507 )
Nenue@18 508 --]]
Nenue@23 509 T.UpdateActionButtons()
Nenue@1 510
Nenue@1 511 end
Nenue@19 512 --]=]
Nenue@1 513
Nenue@21 514
Nenue@21 515 Default.Update = function (self, reason, ...)
Nenue@21 516 local print = tprint
Nenue@21 517 local tracker = self.frame
Nenue@21 518 local blockIndex = 0
Nenue@25 519 local trackerHeight = headerHeight
Nenue@25 520
Nenue@25 521 tracker.title:SetFont(headerFont, headerSize, headerOutline)
Nenue@25 522 tracker.titlebg:SetHeight(headerHeight)
Nenue@25 523 tracker.title:SetTextColor(unpack(headerColor))
Nenue@25 524 --tracker.titlebg:SetGradientAlpha(unpack(headerbg))
Nenue@21 525
Nenue@21 526 self.currentAnchor = tracker.titlebg
Nenue@21 527 local numWatched = self:GetNumWatched()
Nenue@21 528 local numBlocks = self.numBlocks
Nenue@21 529 local actualBlocks = 0
Nenue@21 530 for watchIndex = 1, 25 do
Nenue@21 531 blockIndex = blockIndex + 1
Nenue@21 532 if watchIndex <= numWatched then
Nenue@21 533 local info = self:GetInfo(watchIndex)
Nenue@21 534 if info then
Nenue@21 535 local currentBlock = self:UpdateBlock(blockIndex, info)
Nenue@22 536 currentBlock:SetPoint('TOPLEFT', self.currentAnchor, 'BOTTOMLEFT', 0, 0)
Nenue@21 537 currentBlock:SetPoint('RIGHT', tracker,'RIGHT', 0, 0)
Nenue@21 538 self.currentAnchor = currentBlock
Nenue@22 539 print(' |cFFFFFF00'..watchIndex..'|r', '|cFF00FF00'..currentBlock:GetName()..'|r', currentBlock.height, trackerHeight)
Nenue@21 540 trackerHeight = trackerHeight + currentBlock.height
Nenue@21 541 numBlocks = max(numBlocks, watchIndex)
Nenue@21 542 actualBlocks = actualBlocks + 1
Nenue@21 543 else
Nenue@21 544 print(' |cFFFF0000bad GetInfo data for #'..watchIndex)
Nenue@21 545 end
Nenue@21 546
Nenue@21 547 elseif watchIndex <= numBlocks then
Nenue@21 548 local used = self.usedBlocks
Nenue@21 549 local free = self.freeBlocks
Nenue@21 550 print('clean up dead quest block')
Nenue@21 551 if used[blockIndex] then
Nenue@21 552 used[blockIndex]:Hide()
Nenue@21 553 used[blockIndex]:ClearAllPoints()
Nenue@21 554 free[#free+1]= used[blockIndex]
Nenue@21 555 used[blockIndex] = nil
Nenue@21 556 end
Nenue@21 557 else
Nenue@21 558 print(' |cFFFF9900END|r @', blockIndex)
Nenue@21 559 break -- done with quest stuff
Nenue@21 560 end
Nenue@21 561 end
Nenue@21 562 self.numWatched = numWatched
Nenue@21 563 self.numBlocks = numBlocks
Nenue@21 564 self.actualBlocks = actualBlocks
Nenue@21 565
Nenue@21 566 tracker.previousHeight = tracker.height
Nenue@21 567 if numBlocks >= 1 then
Nenue@21 568 previousBlock = nil
Nenue@25 569 if tracker.isEmpty then
Nenue@25 570 tracker.headerFade:Play()
Nenue@25 571 tracker.isEmpty = nil
Nenue@25 572 end
Nenue@22 573 tracker.height = trackerHeight
Nenue@21 574 tracker:SetHeight(tracker.height)
Nenue@21 575 tracker:Show()
Nenue@21 576 else
Nenue@25 577 tracker.isEmpty = true
Nenue@21 578 tracker.height = 0
Nenue@21 579 tracker:Hide()
Nenue@21 580 end
Nenue@21 581
Nenue@21 582 return tracker.numWatched, tracker.numAll
Nenue@21 583 end
Nenue@21 584
Nenue@21 585 --- Updates the selected block frame to display the given info batch
Nenue@21 586 -- If `previousBlock` is set, it will attempt to anchor to that
Nenue@21 587 -- @param blockNum the ordered block to be updated, not a watchIndex value
Nenue@21 588 -- @param info the reference returned by the GetXInfo functions
Nenue@21 589 -- REMEMBER: t.info and questData[questID] are the same table
Nenue@23 590 Default.UpdateBlock = function (handler, blockIndex, info)
Nenue@21 591 local print = bprint
Nenue@21 592 print(' Read list item |cFF00FFFF'..blockIndex..'|r')
Nenue@21 593 if not blockIndex or not info then
Nenue@21 594 return
Nenue@21 595 end
Nenue@23 596 local frame = handler.frame
Nenue@23 597 local block = T.GetBlock(handler, blockIndex)
Nenue@23 598 block.handler = handler
Nenue@21 599 block.info = info
Nenue@21 600 block.mainStyle = info.mainStyle or 'Normal'
Nenue@21 601 block.subStyle = info.subStyle
Nenue@21 602
Nenue@21 603 info.blockIndex = blockIndex
Nenue@23 604 if info.questID then handler.QuestBlock[info.questID] = block end
Nenue@23 605 if info.questLogIndex then handler.LogBlock[info.questLogIndex] = block end
Nenue@23 606 if info.watchIndex then handler.WatchBlock[info.watchIndex] = block end
Nenue@23 607 handler.BlockInfo[blockIndex] = info
Nenue@21 608
Nenue@21 609 block.endPoint = block.titlebg
Nenue@21 610 block.attachmentHeight = 0
Nenue@23 611 handler:UpdateObjectives(block)
Nenue@21 612
Nenue@21 613 block.title:SetText(info.title)
Nenue@21 614 local titleHeight = floor(block.title:GetHeight()+.5)
Nenue@21 615 local statusHeight = floor(block.status:GetHeight()+.5)
Nenue@21 616 local attachmentHeight =floor(block.attachmentHeight + .5)
Nenue@21 617 local titlebgHeight = titleHeight + titleSpacing*2
Nenue@21 618 local statusbgHeight = statusHeight + textSpacing*2
Nenue@21 619
Nenue@21 620 block.titlebg:SetHeight(titlebgHeight)
Nenue@21 621
Nenue@21 622
Nenue@23 623 print(' |cFF0088FFanchor to', handler.currentAnchor:GetName())
Nenue@21 624
Nenue@21 625 print(' |cFF00FF00total sizes:')
Nenue@21 626 print(' attachment:', attachmentHeight)
Nenue@21 627 print(' title:', titlebgHeight, '('.. titleHeight..')')
Nenue@23 628 --block.titlebg:SetHeight(block.title:GetHeight() + T.Conf.Wrapper.TitleSpacing)
Nenue@21 629 block.height = titlebgHeight + attachmentHeight
Nenue@21 630 if statusHeight > 1 then
Nenue@21 631 block.height = block.height + statusbgHeight
Nenue@21 632 print(' status:', statusbgHeight, '('.. statusHeight..')')
Nenue@21 633 else
Nenue@21 634 print(' |cFFFF0088 skipped')
Nenue@21 635 end
Nenue@21 636 block:SetHeight(block.height)
Nenue@21 637
Nenue@21 638 print(' |cFFFFFF00height|r:', block.height)
Nenue@21 639 print(' |cFF00FFFF)|r -> ', block, block:GetHeight())
Nenue@21 640
Nenue@21 641 block:Show()
Nenue@21 642
Nenue@21 643 if info.specialItem and not info.itemButton then
Nenue@21 644 print(' - |cFF00FFFFgenerating item button for info set')
Nenue@23 645 info.itemButton = T.SetItemButton(block, info)
Nenue@21 646 else
Nenue@21 647 --info.itemButton = nil
Nenue@21 648 end
Nenue@21 649
Nenue@21 650 local tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block, 'TOPRIGHT'
Nenue@21 651 if info.rewardInfo then
Nenue@21 652 print('has immediate reward')
Nenue@21 653 if info.rewardInfo[1].type == 'currency' or info.rewardInfo[1].type == 'item' then
Nenue@21 654 block.icon:Show()
Nenue@21 655 block.iconLabel:SetText(info.rewardInfo[1].count)
Nenue@22 656 block.icon:SetPoint(tagPoint, tagAnchor, tagRelative, -2, -2)
Nenue@21 657 tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', block.icon, 'TOPLEFT'
Nenue@21 658 block.icon:SetTexture(info.rewardInfo[1].texture)
Nenue@21 659 end
Nenue@21 660 else
Nenue@21 661 block.icon:Hide()
Nenue@21 662 end
Nenue@21 663
Nenue@21 664 if info.selected then
Nenue@21 665 block.SelectionOverlay:Show()
Nenue@21 666 else
Nenue@21 667 block.SelectionOverlay:Hide()
Nenue@21 668 end
Nenue@23 669 -- workaround for scrollchild issue where layers fall out of sync: in this case, it's by 1 vertical pixel
Nenue@23 670 --block.highlight:SetPoint('TOPLEFT', block, 'TOPLEFT', 0, 1)
Nenue@23 671 --block.lowlight:SetPoint('BOTTOMLEFT', block, 'BOTTOMLEFT', 0, 1)
Nenue@21 672
Nenue@23 673 tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'frequencyTag', tagPoint, tagAnchor, tagRelative)
Nenue@23 674 tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'typeTag', tagPoint, tagAnchor, tagRelative)
Nenue@23 675 tagPoint, tagAnchor, tagRelative = T.AddTag(block, 'completionTag', tagPoint, tagAnchor, tagRelative)
Nenue@21 676
Nenue@21 677 return block
Nenue@21 678 end
Nenue@21 679 ----------
Nenue@21 680 --- Top level methods
Nenue@21 681
Nenue@21 682 local tick = 0
Nenue@23 683 function T:Update (reason, ...)
Nenue@21 684 tick = tick + 1
Nenue@21 685 local print = tprint
Nenue@21 686 reason = reason or OBJECTIVE_TRACKER_UPDATE_REASON
Nenue@21 687 local updateWrapper = 0
Nenue@21 688 local hasStuff
Nenue@21 689 local insertingStuff
Nenue@21 690
Nenue@23 691 print(format('%d |cFFFF%04X Update()', tick, lshift(reason, 4)), reason, ...)
Nenue@21 692 currentPosition = 0
Nenue@21 693 anchorPoint = 'TOP'
Nenue@21 694 anchorFrame = Scroll
Nenue@21 695
Nenue@21 696 local wrapperHeight = 0
Nenue@23 697 for id, handler in pairs(T.orderedHandlers) do
Nenue@21 698 local frame = handler.frame
Nenue@21 699
Nenue@22 700 print(format('|cFF00FFFF%s and(%04X vs %04x+%04x) = %04X|r', handler.name, reason, handler.updateReasonModule, handler.updateReasonEvents, band(reason, handler.updateReasonModule + handler.updateReasonEvents)))
Nenue@21 701 if band(reason, handler.updateReasonModule + handler.updateReasonEvents) > 0 then
Nenue@21 702 handler:Update(reason, ...)
Nenue@21 703 print(' |cFF00FF00'..id..'|r', handler.displayName, 'count:', handler.numWatched)
Nenue@21 704 insertingStuff = true
Nenue@21 705 else
Nenue@21 706 print(' |cFFFF0088'..id..'|r', 'no reason to update')
Nenue@21 707 end
Nenue@21 708
Nenue@21 709 if handler.numWatched >= 1 then
Nenue@21 710 hasStuff = true
Nenue@21 711 currentPosition = currentPosition + 1
Nenue@21 712 frame:SetParent(Scroll)
Nenue@21 713 frame:SetPoint('TOP', anchorFrame, anchorPoint, 0, 0)
Nenue@21 714 print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint)
Nenue@21 715 anchorFrame = handler.frame
Nenue@21 716 anchorPoint = 'BOTTOM'
Nenue@21 717
Nenue@21 718 print('current frame height:', frame.height)
Nenue@21 719 wrapperHeight = wrapperHeight + frame.height
Nenue@21 720 print('|cFFFF0088total height:', wrapperHeight)
Nenue@21 721 else
Nenue@21 722 handler.frame:Hide()
Nenue@21 723 end
Nenue@21 724 end
Nenue@21 725
Nenue@21 726
Nenue@21 727 if hasStuff or insertingStuff then
Nenue@21 728 print('updating height to', wrapperHeight)
Nenue@21 729 Wrapper:SetHeight(wrapperHeight)
Nenue@21 730 Scroller:SetHeight(wrapperHeight)
Nenue@21 731 Scroll:SetHeight(wrapperHeight)
Nenue@21 732 Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0)
Nenue@21 733 print('|cFFFF8800Wrapper:', Wrapper:GetSize())
Nenue@21 734 for i = 1, Wrapper:GetNumPoints() do
Nenue@21 735 print(' ', Wrapper:GetPoint(i))
Nenue@21 736 end
Nenue@21 737 print(' |cFF00FFFFScroller:', Scroller:GetSize())
Nenue@21 738 for i = 1, Scroller:GetNumPoints() do
Nenue@21 739 print(' ', Scroller:GetPoint(i))
Nenue@21 740 end
Nenue@21 741 print(' |cFF00FFFFScroll:', Scroll:GetSize())
Nenue@21 742 for i = 1, Scroll:GetNumPoints() do
Nenue@21 743 print(' ', Scroll:GetPoint(i))
Nenue@21 744 end
Nenue@21 745
Nenue@21 746 Wrapper:Show()
Nenue@21 747 Scroller:Show()
Nenue@21 748 Scroll:Show()
Nenue@21 749 end
Nenue@23 750 Quest.GetClosest()
Nenue@24 751 --T.UpdateActionButtons(reason)
Nenue@21 752 end
Nenue@21 753
Nenue@1 754 --- Queue any active item buttons for update for that frame
Nenue@24 755 local iprint = B.print('ItemButton')
Nenue@23 756 T.UpdateActionButtons = function(updateReason)
Nenue@24 757 local print = iprint
Nenue@6 758 Scroller.snap_upper = 0
Nenue@6 759 Scroller.snap_lower = 0
Nenue@6 760 local print = B.print('ItemButton')
Nenue@6 761 if updateReason then
Nenue@6 762 print = B.print('IB_'..updateReason)
Nenue@6 763 end
Nenue@6 764
Nenue@1 765 local previousItem
Nenue@24 766 for questID, itemButton in pairs(Quest.itemButtons) do
Nenue@23 767 local info= T.Quest.Info[questID]
Nenue@6 768
Nenue@5 769 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
Nenue@23 770 local block = T.Quest.QuestBlock[questID]
Nenue@1 771 if block then
Nenue@5 772 -- Dispatch the probe
Nenue@6 773 if IsQuestWatched(info.questLogIndex) then
Nenue@6 774 itemButton.previousItem = previousItem
Nenue@5 775 print(' |cFFFFFF00probing', block:GetName())
Nenue@1 776 block:SetScript('OnUpdate', function()
Nenue@5 777 if block:GetBottom() and not InCombatLockdown() then
Nenue@5 778 print(' '..block:GetName()..' |cFF00FF00probe hit!')
Nenue@23 779 T.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
Nenue@5 780 block:SetScript('OnUpdate', nil)
Nenue@22 781
Nenue@5 782 end
Nenue@5 783 end)
Nenue@6 784 previousItem = itemButton
Nenue@1 785 else
Nenue@5 786 print('hidden block or unwatched quest')
Nenue@6 787 itemButton.previousItem = nil
Nenue@5 788 itemButton:Hide()
Nenue@1 789 end
Nenue@8 790 elseif itemButton:IsVisible() then
Nenue@8 791 print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
Nenue@6 792 itemButton.previousItem = nil
Nenue@6 793 itemButton:Hide()
Nenue@8 794 else
Nenue@8 795 print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
Nenue@1 796 end
Nenue@1 797 end
Nenue@1 798 end
Nenue@1 799
Nenue@23 800 T.UpdateBlockAction = function (block, itemButton)
Nenue@24 801 local print = iprint
Nenue@5 802 print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()')
Nenue@5 803 if itemButton.questID ~= block.info.questID then
Nenue@5 804 print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID)
Nenue@6 805 -- something happened between this and last frame, go back and set new probes
Nenue@23 806 return T.UpdateActionButtons()
Nenue@2 807 end
Nenue@2 808
Nenue@6 809 local previousItem = itemButton.previousItem
Nenue@6 810 local upper_bound = Scroller:GetTop() + Scroller.snap_upper
Nenue@6 811 local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize
Nenue@6 812 local point, anchor, relative
Nenue@6 813
Nenue@6 814 if block:GetBottom() < lower_bound then
Nenue@6 815 print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5))
Nenue@1 816 if previousItem then
Nenue@6 817 print('adjusting', previousItem:GetName())
Nenue@1 818 previousItem:ClearAllPoints()
Nenue@6 819 previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing)
Nenue@1 820 end
Nenue@1 821 itemButton:ClearAllPoints()
Nenue@6 822 itemButton.x = Wrapper:GetLeft() -4
Nenue@6 823 itemButton.y = Wrapper:GetBottom()
Nenue@6 824 point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT'
Nenue@6 825 Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing
Nenue@6 826
Nenue@6 827 elseif block:GetTop() > upper_bound then
Nenue@6 828 print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5))
Nenue@6 829 itemButton:ClearAllPoints()
Nenue@6 830 if previousItem then
Nenue@6 831 print('latch onto another piece')
Nenue@6 832 point, anchor, relative ='TOP', previousItem, 'BOTTOM'
Nenue@6 833 itemButton.x = 0
Nenue@6 834 itemButton.y = -itemButtonSpacing
Nenue@6 835 else
Nenue@6 836 print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop())
Nenue@6 837 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
Nenue@6 838 itemButton.x = Scroller:GetLeft() -4
Nenue@6 839 itemButton.y = Scroller:GetTop()
Nenue@6 840 end
Nenue@1 841 itemButton:Show()
Nenue@6 842 Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing)
Nenue@1 843 else
Nenue@6 844 print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5))
Nenue@1 845 itemButton:ClearAllPoints()
Nenue@6 846 itemButton.x = block:GetLeft() - itemButtonSpacing
Nenue@6 847 itemButton.y = block:GetTop()
Nenue@6 848 point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT'
Nenue@1 849 end
Nenue@6 850
Nenue@6 851 itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y)
Nenue@6 852 itemButton:Show()
Nenue@1 853 end
Nenue@1 854
Nenue@23 855 T.UpdateItemButtonCooldown = function(button)
Nenue@1 856
Nenue@1 857 end
Nenue@18 858
Nenue@18 859 local unitLevel = UnitLevel('player')
Nenue@18 860
Nenue@18 861