Nenue@28: --- ${PACKAGE_NAME} Nenue@28: -- @file-author@ Nenue@28: -- @project-revision@ @project-hash@ Nenue@28: -- @file-revision@ @file-hash@ Nenue@28: -- Created: 3/30/2016 12:49 AM Nenue@28: local B = select(2,...).frame Nenue@35: local T = B:RegisterModule("ObjectiveTracker", _G.VeneerObjectiveWrapper, 'BuffFrame') Nenue@28: local _G, ipairs, max, min, unpack, floor, pairs, tostring, type, band = _G, ipairs, max, min, unpack, floor, pairs, tostring, type, bit.band Nenue@34: local IsResting, UnitXP, UnitXPMax, GetXPExhaustion, tinsert, tremove = IsResting, UnitXP, UnitXPMax, GetXPExhaustion, table.insert, table.remove Nenue@28: local UnitLevel, IsQuestWatched, UIParent = UnitLevel, IsQuestWatched, UIParent Nenue@28: local GetAutoQuestPopUp, GetQuestLogCompletionText = GetAutoQuestPopUp, GetQuestLogCompletionText Nenue@28: local PERCENTAGE_STRING, GetQuestProgressBarPercent = PERCENTAGE_STRING, GetQuestProgressBarPercent Nenue@35: local Default, AutoQuest, Quest, Bonus, Cheevs = T.DefaultHandler, T.AutoQuest, T.Quest, T.Bonus, T.Cheevs Nenue@28: local InCombatLockdown, format, lshift, CreateFrame = InCombatLockdown, format, bit.lshift, CreateFrame Nenue@29: local IsModifiedClick, ChatEdit_GetActiveWindow = IsModifiedClick, ChatEdit_GetActiveWindow Nenue@35: local print = B.print('Layout') Nenue@34: local oprint = B.print('Objectives') Nenue@34: local bprint = B.print('Block') Nenue@34: local tprint = B.print('Tracker') Nenue@35: local lprint = B.print('Layout') Nenue@28: local unitLevel = 1 Nenue@28: local OBJECTIVE_TRACKER_UPDATE_REASON = OBJECTIVE_TRACKER_UPDATE_REASON Nenue@28: local debug = false Nenue@28: Nenue@34: --- FRAMES Nenue@28: local Wrapper = _G.VeneerObjectiveWrapper Nenue@28: local Scroller = Wrapper.scrollArea Nenue@28: local Scroll = _G.VeneerObjectiveScroll Nenue@35: local orderedHandlers = T.orderedHandlers Nenue@35: local orderedNames = T.orderedNames Nenue@28: Nenue@34: --- FRAME TEMP VARIABLES Nenue@28: local wrapperWidth, wrapperHeight Nenue@28: local scrollWidth, scrollHeight Nenue@34: Nenue@34: --- SCHEMA VARIABLES Nenue@34: local schemaName, lastSchema = { Nenue@34: tracker = '', Nenue@34: block = '', Nenue@34: line = '' Nenue@34: }, {} Nenue@34: local trackerSchema, blockSchema, lineSchema Nenue@34: Nenue@28: local itemButtonSize, itemButtonSpacing = 36, 1 Nenue@34: local wrapperMaxWidth, wrapperMaxHeight = 270, 490 -- these are the hard bounds, actual *Height variables are changed Nenue@34: local wrapperHeadFont, wrapperHeadSize, wrapperHeadOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'NONE' Nenue@34: local wrapperPosition = {'RIGHT', UIParent, 'RIGHT', -84, 0 } Nenue@34: local rewardSize = 24 Nenue@28: Nenue@30: local headerHeight, headerColor, headerSpacing = 16, {1,.75,0,1}, 2 Nenue@28: local headerbg = {'VERTICAL', 1, 1, 0.5, 0.5, 1, 1, 0.5, 0} Nenue@28: local headerFont, headerSize, headerOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 14, 'OUTLINE' Nenue@28: Nenue@31: local titlebg = {'HORIZONTAL', 1, 0, .7, 0, 1, 0, .7, .2} Nenue@28: local titleFont, titleSize, titleOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Bold.ttf]], 16, 'OUTLINE' Nenue@34: local titleColor = {0,.7,1,1} Nenue@28: Nenue@28: local textbg = {'HORIZONTAL', 0, 0, 0, 0.4, 0, 0, 0, 0 } Nenue@28: local textFont, textSize, textOutline = [[Interface\Addons\SharedMedia_MyMedia\font\ArchivoNarrow-Regular.ttf]], 16, 'OUTLINE' Nenue@34: local textColor = {1,1,1,1} Nenue@28: Nenue@28: local selectionbg = {'HORIZONTAL', 1, 1, 1, 0, 1, 1, 1, 0.225} Nenue@28: local titleSpacing, textSpacing, blockSpacing = 3, 3, 1 Nenue@28: local titleIndent, textIndent,selectionIndent = 2, 5, 50 Nenue@34: --- END SCHEMA Nenue@35: local blockPosition Nenue@35: Nenue@34: --- schema swapper Nenue@35: T.UpdateSchema = function(layer, newSchema) Nenue@35: if not (T.Conf.Schema[layer] and T.Conf.Schema[layer][newSchema]) then Nenue@34: return Nenue@34: elseif schemaName[layer] == newSchema then Nenue@34: return Nenue@34: end Nenue@34: lastSchema[layer] = schemaName[layer] Nenue@34: schemaName[layer] = newSchema Nenue@35: local c = T.Conf.Schema[layer][newSchema] Nenue@28: Nenue@34: if layer == 'tracker' then Nenue@34: headerHeight, headerSpacing = c.headerHeight, c.headerSpacing Nenue@34: headerColor = c.headerColor Nenue@34: headerbg = c.headerbg Nenue@34: headerFont, headerSize, headerOutline = c.headerFont, c.headerSize, c.headerOutline Nenue@34: trackerSchema = newSchema Nenue@34: elseif layer == 'block' then Nenue@34: titlebg = c.titlebg Nenue@34: titleFont, titleSize, titleOutline = c.titleFont, c.titleSize, c.titleOutline Nenue@34: selectionbg = c.selectionbg Nenue@34: titleSpacing, textSpacing, blockSpacing = c.titleSpacing, c.textSpacing, c.blockSpacing Nenue@34: titleIndent, textIndent,selectionIndent = 2, 5, 50 Nenue@34: titleColor = c.titleColor Nenue@34: rewardSize = 24 Nenue@34: blockSchema = newSchema Nenue@34: textFont, textSize, textOutline = c.textFont, c.textSize, c.textOutline Nenue@34: textbg = c.textbg Nenue@34: textIndent = c.textIndent Nenue@34: rewardSize = c.rewardSize Nenue@34: elseif layer == 'line' then Nenue@34: textColor = c.textColor Nenue@34: lineSchema = newSchema Nenue@34: end Nenue@34: print('|cFFFF0088UpdateSchema:|r', layer, lastSchema[layer], '->', newSchema) Nenue@34: end Nenue@35: -- todo: figure out why objectives go invisible Nenue@35: local anchorPoint, anchorFrame Nenue@35: local abs, GetTime = math.abs, GetTime Nenue@35: Default.AddTracker = function(handler, frame, index) Nenue@35: if index == 1 then Nenue@35: print('|cFF00FF00### beginning wrapper layout -----------------') Nenue@35: anchorPoint, anchorFrame = 'TOP', Scroll Nenue@35: wrapperHeight = 0 Nenue@35: end Nenue@35: Nenue@35: frame.destinationOffset = -wrapperHeight Nenue@35: print(frame.destinationOffset, frame.previousOffset) Nenue@35: if handler.initialized and (abs(frame.previousOffset - frame.destinationOffset) > 0.9) and frame:IsVisible() then Nenue@35: if frame.wasEmpty then Nenue@35: frame.previousOffset = -Wrapper:GetHeight() Nenue@35: end Nenue@35: Nenue@35: local postFrame, postPoint = anchorFrame, anchorPoint Nenue@35: local delta = frame.destinationOffset - frame.previousOffset Nenue@35: local _, _, _, _, offset = frame:GetPoint(1) Nenue@35: print(' |cFF00FFBBpushing', frame:GetName(), delta, 'pixels, from', frame.previousOffset, '(', offset, ')') Nenue@35: frame.SlideIn.translation:SetTarget(frame) Nenue@35: frame.SlideIn.translation:SetOffset(0, delta) Nenue@35: frame.SlideIn:Play() Nenue@35: --for i, b in ipairs(handler.usedBlocks) do Nenue@35: --b.SlideIn.translation:SetOffset(0, delta) Nenue@35: -- b.SlideIn:Play() Nenue@35: --end Nenue@35: local start = GetTime() Nenue@35: frame.SlideIn:SetScript('OnFinished', function() Nenue@35: print(' |cFF00BBFF'..frame:GetName(), 'moved', delta, 'over duration of ', GetTime()-start) Nenue@35: frame:SetParent(Scroll) Nenue@35: frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) Nenue@35: frame.previousOffset = frame.destinationOffset Nenue@35: frame.SlideIn:SetScript('OnFinished', nil) Nenue@35: if Wrapper.destinationHeight then Nenue@35: Wrapper:SetHeight(Wrapper.destinationHeight) Nenue@35: Scroller:SetHeight(Wrapper.destinationHeight) Nenue@35: Scroll:SetHeight(Wrapper.destinationHeight) Nenue@35: Wrapper.previousHeight = Wrapper.destinationHeight Nenue@35: Wrapper.destinationHeight = nil Nenue@35: end Nenue@35: Nenue@35: end) Nenue@35: else Nenue@35: print(' |cFF00BBFFpinning to', anchorFrame:GetName(), anchorPoint, '|rcurrent frame height:', frame.height) Nenue@35: print(' |cFFFF0088total height:', wrapperHeight) Nenue@35: frame:ClearAllPoints() Nenue@35: frame:SetParent(Scroll) Nenue@35: frame:SetPoint('TOP', Scroll, 'TOP', 0, frame.destinationOffset) Nenue@35: frame.previousOffset = frame.destinationOffset Nenue@35: handler.initialized = true Nenue@35: end Nenue@35: Nenue@35: frame.title:SetFont(headerFont, headerSize, headerOutline) Nenue@35: frame.titlebg:SetHeight(headerHeight) Nenue@35: frame.title:SetTextColor(unpack(headerColor)) Nenue@35: Nenue@35: if frame.height ~= frame.previousHeight then Nenue@35: frame:SetHeight(frame.height) Nenue@35: end Nenue@35: Nenue@35: frame:Show() Nenue@35: if frame.wasEmpty then Nenue@35: frame.headerFade:Play() Nenue@35: frame.wasEmpty = nil Nenue@35: end Nenue@35: Nenue@35: wrapperHeight = wrapperHeight + frame.height Nenue@35: anchorFrame = handler.frame Nenue@35: anchorPoint = 'BOTTOM' Nenue@35: Nenue@35: end Nenue@28: Nenue@30: Default.AddBlock = function(self, block, blockIndex) Nenue@30: local blockIndex = blockIndex or (self.currentBlock + 1) Nenue@28: local print = bprint Nenue@28: local tracker = self.frame Nenue@28: local info = block.info Nenue@30: Nenue@35: block.index = blockIndex Nenue@35: Nenue@34: if blockSchema ~= block.schema then Nenue@34: print('new schema detected, applicating...') Nenue@34: block.schema = blockSchema Nenue@35: block:SetWidth(T.Conf.Wrapper.Width) Nenue@34: block.title:SetSpacing(titleSpacing) Nenue@34: block.title:SetPoint('TOP', block, 'TOP', 0, -titleSpacing) Nenue@34: block.title:SetPoint('LEFT', block, 'LEFT', titleIndent, 0) Nenue@34: block.titlebg:SetTexture(1,1,1,1) Nenue@34: block.titlebg:SetGradientAlpha(unpack(titlebg)) Nenue@34: block.titlebg:SetPoint('TOP', block, 'TOP', 0, 0) Nenue@34: block.titlebg:SetPoint('BOTTOM', block.title, 'BOTTOM', 0, -titleSpacing) Nenue@34: block.status:SetSpacing(textSpacing) Nenue@34: block.status:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, -textSpacing) Nenue@34: block.status:SetPoint('LEFT', block.titlebg, 'LEFT', textIndent, 0) Nenue@34: block.statusbg:SetPoint('TOP', block.titlebg, 'BOTTOM', 0, 0) Nenue@34: block.statusbg:SetPoint('BOTTOM', block, 'BOTTOM', 0, 0) Nenue@34: block.statusbg:SetTexture(1,1,1,1) Nenue@34: block.statusbg:SetGradientAlpha(unpack(textbg)) Nenue@34: block.SelectionOverlay:SetGradientAlpha(unpack(selectionbg)) Nenue@34: block.SelectionOverlay:SetPoint('TOPLEFT', selectionIndent, 0) Nenue@34: block.SelectionOverlay:SetPoint('BOTTOMRIGHT') Nenue@34: Nenue@34: local anchor, target, point, x, y = 'TOPRIGHT', block, 'TOPRIGHT', -2, -2 Nenue@34: for i, tile in ipairs(block.rewardTile) do Nenue@34: print(rewardSize) Nenue@34: tile:SetSize(rewardSize, rewardSize) Nenue@34: tile:ClearAllPoints() Nenue@34: tile:SetPoint(anchor, target, point, x, y) Nenue@34: block.rewardLabel[i]:SetPoint('TOP', tile, 'TOP', 0, 0) Nenue@34: anchor, target, point, x, y = 'TOPRIGHT', tile, 'TOPLEFT', -2, 0 Nenue@34: end Nenue@34: end Nenue@34: Nenue@35: Nenue@35: local titleHeight = floor(block.title:GetHeight()+.5) Nenue@35: local titlebgHeight = titleHeight + titleSpacing*2 Nenue@35: block.titlebg:SetHeight(titlebgHeight) Nenue@35: Nenue@35: local statusHeight = floor(block.status:GetHeight()+.5) Nenue@35: local statusbgHeight = statusHeight + textSpacing*2 Nenue@35: local attachmentHeight =floor(block.attachmentHeight + .5) Nenue@35: Nenue@35: print(' |cFF0088FFanchor to', self.currentAnchor:GetName()) Nenue@35: print(' |cFF00FF00attachment:|r', attachmentHeight, '|cFF00FF00title:|r', titlebgHeight, '('.. titleHeight..')') Nenue@35: if attachmentHeight > 0 then Nenue@35: attachmentHeight = attachmentHeight + textSpacing Nenue@35: end Nenue@35: Nenue@35: block.height = titlebgHeight + attachmentHeight Nenue@35: block:SetHeight(block.height) Nenue@35: Nenue@34: if block.debug then Nenue@34: local func = (B.Conf.GuidesMode == true) and 'Show' or 'Hide' Nenue@34: for _, region in ipairs(block.debug) do Nenue@34: region[func]() Nenue@34: end Nenue@34: end Nenue@34: Nenue@35: --- Handler vars Nenue@35: if blockIndex == 1 then Nenue@35: tracker.previousHeight = tracker.height Nenue@35: tracker.height = headerHeight Nenue@35: blockPosition = -headerHeight Nenue@35: tprint(' |cFF88FF00AddBlock:|r new layout: headerHeight =', headerHeight, 'previousHeight =', tracker.previousHeight) Nenue@35: else Nenue@35: blockPosition = blockPosition Nenue@35: tprint(' |cFF8888FFAddBlock:|r advancing: height =', tracker.height) Nenue@35: end Nenue@30: self.currentBlock = blockIndex Nenue@29: self.currentAnchor = block Nenue@35: Nenue@35: block:SetPoint('TOPLEFT', self.frame, 'TOPLEFT', 0, blockPosition) Nenue@35: block:SetPoint('RIGHT', tracker,'RIGHT', 0, 0) Nenue@35: self.numBlocks = self.numBlocks + 1 Nenue@29: print(' |cFFFFFF00'..tracker.height..'|r', '|cFF00FF00'..block:GetName()..'|r', block.height, tracker.height) Nenue@29: tracker.height = tracker.height + block.height Nenue@35: blockPosition = blockPosition - block.height Nenue@28: end Nenue@28: Nenue@28: --- Used as an iterator of sorts for cascaded tag icon placements (the daily/faction/account icons) Nenue@30: Default.AddTag = function (handler, block, tagInfo, tagPoint, tagAnchor, tagRelative) Nenue@28: local print = bprint Nenue@30: Nenue@30: for order, tagName in ipairs(block.info.tagInfo) do Nenue@30: local tag = block[tagName] Nenue@30: if block.tagCoords[tagName] and tag then Nenue@30: tag:SetTexCoord(unpack(block.tagCoords[tagName])) Nenue@30: tag:Show() Nenue@30: tag:SetPoint(tagPoint, tagAnchor, tagRelative, 0, 0) Nenue@30: tagPoint, tagAnchor, tagRelative = 'TOPRIGHT', tag, 'TOPLEFT' Nenue@30: else Nenue@30: block[tagName]:Hide() Nenue@30: end Nenue@28: end Nenue@30: Nenue@28: return tagPoint, tagAnchor, tagRelative Nenue@28: end Nenue@28: Nenue@28: --- Adds the given line to the current content and advances the anchor pointer to that new line for the following call. Nenue@30: Default.AddLine = function(handler, block, text, attachment, template) Nenue@28: local print = lprint Nenue@30: local lineIndex = block.currentLine + 1 Nenue@34: local line = handler:GetLine(block, lineIndex) Nenue@31: line.index = lineIndex Nenue@35: if template then Nenue@35: if line.schema ~= template then Nenue@35: print(' |cFF00FF00change schema', template) Nenue@35: T.UpdateSchema('line', template) Nenue@35: line.status:SetSpacing(textSpacing) Nenue@35: line.status:SetPoint('LEFT', line, 'LEFT', textIndent, 0) Nenue@35: line.status:SetPoint('RIGHT', line, 'RIGHT',0, 0) Nenue@35: line.status:SetTextColor(unpack(textColor)) Nenue@35: line.schema = template Nenue@35: else Nenue@35: print(' |cFFFFFF00keep schema', line.schema) Nenue@35: end Nenue@34: end Nenue@34: line:SetPoint('TOP', block.endPoint, 'BOTTOM', 0, -textSpacing) Nenue@28: line:Show() Nenue@28: Nenue@34: Nenue@35: tprint(' |cFF0088FFAddLine|r (|cFF00FFFF'..tostring(line.schema)..'|r):', line:GetName()) Nenue@34: Nenue@34: Nenue@34: -- fill in the text, then derive pixel-rounded height Nenue@30: line.status:SetText(text) Nenue@34: line.height = floor(line.status:GetStringHeight()+.5) Nenue@30: Nenue@30: -- For progressbar and timer lines, status text may be used as the title heading Nenue@30: if attachment then Nenue@35: print(' |cFFFF0088doing things with a widget', attachment:GetSize()) Nenue@34: line.height = attachment:GetHeight() Nenue@34: if text then Nenue@34: line.height = max(line.height, line.status:GetStringHeight()) Nenue@31: end Nenue@34: if attachment.status:GetText() then Nenue@34: line.height = max(line.height, attachment.status:GetStringHeight()) Nenue@34: end Nenue@30: attachment:Show() Nenue@30: end Nenue@30: Nenue@34: line:SetHeight(line.height) Nenue@34: block.attachmentHeight = block.attachmentHeight + line.height + textSpacing Nenue@35: Nenue@35: local debug_points = '' Nenue@35: for i = 1, line:GetNumPoints() do Nenue@35: local point, parent, anchor = line:GetPoint(i) Nenue@35: debug_points = debug_points .. tostring(parent:GetName()) .. ', ' .. anchor .. ' ' Nenue@35: end Nenue@35: Nenue@35: print(' |cFF0088FFsetting line #'..lineIndex..' for|r', block.info.title, "\n |cFF0088FFsize:|r", line.height, Nenue@35: "|cFF0088FFpoint:|r", debug_points, "|cFF0088FFwidget:|r", (line.widget and 'Y' or 'N')) Nenue@30: block.currentLine = lineIndex Nenue@31: block.endPoint = line.statusbg -- edge used for the next block Nenue@31: Nenue@31: return lineIndex Nenue@28: end Nenue@28: Nenue@28: --- Creates or retrieves a complete line data object Nenue@30: Default.GetLine = function(handler, block, lineIndex) Nenue@28: local print = lprint Nenue@28: local blockIndex = block.index Nenue@30: local lines = block.lines Nenue@30: if not lineIndex then Nenue@30: lineIndex = block.currentLine + 1 Nenue@34: print(' |cFFFFFF00generating a frame') Nenue@28: end Nenue@30: Nenue@30: block.numLines = max(block.numLines, lineIndex) Nenue@30: Nenue@28: if not lines[lineIndex] then Nenue@28: print(' |cFF00FF88created line #'..lineIndex..' from for '..handler.name..' block #'..blockIndex) Nenue@28: lines[lineIndex] = CreateFrame('Frame', 'Vn'..handler.name .. blockIndex..'ObjectiveLine'..lineIndex, block, 'VeneerTrackerObjective') Nenue@28: local line = lines[lineIndex] Nenue@28: line.index = lineIndex Nenue@28: line.height = 0 Nenue@35: line.schema = 'default' Nenue@28: B.SetConfigLayers(line) Nenue@28: Nenue@28: if debug then Nenue@28: for _, region in ipairs(lines[lineIndex].debug) do Nenue@28: region:Show() Nenue@28: end Nenue@28: end Nenue@28: Nenue@28: end Nenue@28: return lines[lineIndex] Nenue@28: end Nenue@28: Nenue@29: Nenue@29: Nenue@28: --- Creates or retrieves a complete block frame object Nenue@34: --- todo: make it use data index to avoid re-coloring every block Nenue@34: Default.GetBlock = function(handler, logIndex) Nenue@28: local print = bprint Nenue@35: print('|cFF0088FFgetting a block for logID', logIndex ..',', #handler.usedBlocks,'used', #handler.freeBlocks, 'free') Nenue@34: local block = handler.LogBlock[logIndex] Nenue@35: local used = handler.usedBlocks Nenue@28: Nenue@34: if not block then Nenue@28: if #handler.freeBlocks >= 1 then Nenue@34: block = tremove(handler.freeBlocks) Nenue@35: tinsert(handler.usedBlocks, block) Nenue@35: block.posIndex = #handler.usedBlocks Nenue@35: print(' |cFF00FF00 assigning from free heap', block:GetName()) Nenue@28: else Nenue@34: Nenue@35: local blockIndex = (#handler.usedBlocks + #handler.freeBlocks) + 1 Nenue@30: block = CreateFrame('Frame', 'Veneer'..tostring(handler)..'Block'..blockIndex, handler.frame, 'VeneerTrackerBlock') Nenue@35: --block:SetParent() Nenue@30: block.lines = {} Nenue@30: block.numLines = 0 Nenue@30: block.currentLine = 0 Nenue@34: block.attachmentHeight = 0 Nenue@35: block.offset = 0 Nenue@34: B.SetConfigLayers(block) Nenue@28: --- methods for event handlers Nenue@28: Nenue@28: block.Select = handler.Select Nenue@28: block.Open = handler.Open Nenue@28: block.Remove = handler.Remove Nenue@28: block.Link = handler.Link Nenue@28: block.clickZone:SetScript('OnMouseUp', function(self, ...) handler.OnMouseUp(block, ...) end) Nenue@28: block.clickZone:SetScript('OnMouseDown', function(self, ...) handler.OnMouseDown(block, ...) end) Nenue@28: block:ClearAllPoints() Nenue@34: block.index = blockIndex Nenue@35: print(' |cFF00FFBBcreating new|r', block:GetName()) Nenue@28: end Nenue@34: handler.LogBlock[logIndex] = block Nenue@34: tinsert(handler.usedBlocks, block) Nenue@35: block.posIndex = #handler.usedBlocks Nenue@34: else Nenue@34: print(' |cFFFFFF00use existing block|r', block:GetName()) Nenue@35: local found = false Nenue@35: for i, entry in ipairs(used) do Nenue@35: if entry == block then Nenue@35: found = true Nenue@35: break Nenue@35: end Nenue@35: end Nenue@35: if not found then Nenue@35: tinsert(used, block) Nenue@35: block.posIndex = #used Nenue@35: end Nenue@28: end Nenue@34: return block Nenue@28: end Nenue@28: Nenue@34: Nenue@30: Nenue@30: Nenue@28: ---------- Nenue@28: --- Top level methods Nenue@28: Nenue@28: Nenue@35: T.UpdateBlockAction = function (block, itemButton) Nenue@35: local print = bprint Nenue@28: print('**|cFF0088FF'..itemButton:GetName(), '|r:Update()') Nenue@28: if itemButton.questID ~= block.info.questID then Nenue@28: print('** |cFFFF0088mismatched block assignment', itemButton.questID,'<~>', block.info.questID) Nenue@28: -- something happened between this and last frame, go back and set new probes Nenue@35: return T.UpdateActionButtons() Nenue@28: end Nenue@28: Nenue@28: local previousItem = itemButton.previousItem Nenue@28: local upper_bound = Scroller:GetTop() + Scroller.snap_upper Nenue@28: local lower_bound = Scroller:GetBottom() + Scroller.snap_lower + itemButtonSize Nenue@28: local point, anchor, relative Nenue@28: Nenue@28: if block:GetBottom() < lower_bound then Nenue@28: print('** ',block:GetName() ,'|cFFFFFF00bottom =', floor(block:GetBottom()+.5), 'threschold =', floor(lower_bound+.5)) Nenue@28: if previousItem then Nenue@28: print('adjusting', previousItem:GetName()) Nenue@28: previousItem:ClearAllPoints() Nenue@28: previousItem:SetPoint('BOTTOM', itemButton, 'TOP', 0, itemButtonSpacing) Nenue@28: end Nenue@28: itemButton:ClearAllPoints() Nenue@28: itemButton.x = Wrapper:GetLeft() -4 Nenue@28: itemButton.y = Wrapper:GetBottom() Nenue@28: point, anchor, relative = 'BOTTOMRIGHT', UIParent, 'BOTTOMLEFT' Nenue@28: Scroller.snap_lower = Scroller.snap_lower + itemButtonSize + itemButtonSpacing Nenue@28: Nenue@28: elseif block:GetTop() > upper_bound then Nenue@28: print('** ',block:GetName() ,'|cFFFFFF00top =', floor(block:GetTop()+.5), 'threschold =', floor(upper_bound+.5)) Nenue@28: itemButton:ClearAllPoints() Nenue@28: if previousItem then Nenue@28: print('latch onto another piece') Nenue@28: point, anchor, relative ='TOP', previousItem, 'BOTTOM' Nenue@28: itemButton.x = 0 Nenue@28: itemButton.y = -itemButtonSpacing Nenue@28: else Nenue@28: print('latch at corner', Scroller:GetLeft() -itemButtonSpacing, Scroller:GetTop()) Nenue@28: point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT' Nenue@28: itemButton.x = Scroller:GetLeft() -4 Nenue@28: itemButton.y = Scroller:GetTop() Nenue@28: end Nenue@28: itemButton:Show() Nenue@28: Scroller.snap_upper = Scroller.snap_upper - (itemButtonSize + itemButtonSpacing) Nenue@28: else Nenue@28: print('** ',block:GetName() ,'|cFF00FF00span =', floor(block:GetBottom()+.5), floor(block:GetTop()+.5), 'threschold =', floor(lower_bound+.5)) Nenue@28: itemButton:ClearAllPoints() Nenue@28: itemButton.x = block:GetLeft() - itemButtonSpacing Nenue@28: itemButton.y = block:GetTop() Nenue@28: point, anchor, relative = 'TOPRIGHT', UIParent, 'BOTTOMLEFT' Nenue@28: end Nenue@28: Nenue@28: itemButton:SetPoint(point, anchor, relative, itemButton.x, itemButton.y) Nenue@28: itemButton:Show() Nenue@28: end Nenue@28: Nenue@35: T.UpdateItemButtonCooldown = function(button) Nenue@28: Nenue@28: end Nenue@28: Nenue@35: function T:FinishWrapper () Nenue@35: if wrapperHeight > Wrapper.previousHeight then Nenue@35: Wrapper:SetHeight(wrapperHeight) Nenue@35: Scroller:SetHeight(wrapperHeight*3) Nenue@35: Scroll:SetHeight(wrapperHeight) Nenue@35: Wrapper.previousHeight = wrapperHeight Nenue@35: Wrapper.destinationHeight = wrapperHeight Nenue@35: end Nenue@35: Scroller:SetVerticalScroll(B.Conf.ObjectiveScroll or 0) Nenue@35: print('|cFF00FF00### end of wrapper layout', Wrapper:GetSize()) Nenue@35: print(' |cFF00FF00Scroller:', Scroller:GetSize()) Nenue@35: print(' |cFF00FF00Scroll:', Scroll:GetSize()) Nenue@35: for i = 1, Wrapper:GetNumPoints() do Nenue@35: print('|cFF00FF00 ', Wrapper:GetPoint(i)) Nenue@35: end Nenue@35: for i = 1, Scroller:GetNumPoints() do Nenue@35: print('|cFF00FF00 ', Scroller:GetPoint(i)) Nenue@35: end Nenue@35: for i = 1, Scroll:GetNumPoints() do Nenue@35: print('|cFF00FF00 ', Scroll:GetPoint(i)) Nenue@35: end Nenue@34: Nenue@35: Wrapper:Show() Nenue@35: Scroller:Show() Nenue@35: Scroll:Show() Nenue@28: end Nenue@28: