Mercurial > wow > buffalo2
changeset 108:a41f6b74709a
- Handler number and boolean cluster arguments as positioning priority layer and "always top" respectively
- Use SetShown and IsShown instead of IsVisible in doing full re-anchor checks
author | Nick@Zahhak |
---|---|
date | Sat, 25 Feb 2017 11:42:07 -0500 |
parents | ff00679a7817 |
children | 26938ae258b7 |
files | Font/ArchivoNarrow-Bold.ttf Font/ArchivoNarrow-BoldItalic.ttf Font/ArchivoNarrow-Italic.ttf Font/ArchivoNarrow-Regular.ttf Modules/ArtifactPower.lua Modules/ArtifactPower.xml Modules/BuffFrame.lua Modules/BuffFrame.xml Modules/GuildInfo.lua Modules/WorldState.lua Templates.lua Veneer.lua |
diffstat | 12 files changed, 273 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/Modules/ArtifactPower.lua Sun Jan 29 09:57:09 2017 -0500 +++ b/Modules/ArtifactPower.lua Sat Feb 25 11:42:07 2017 -0500 @@ -50,7 +50,8 @@ self:RegisterEvent('PLAYER_REGEN_ENABLED') self:RegisterEvent('PLAYER_REGEN_DISABLED') self:RegisterEvent('PLAYER_ENTERING_WORLD') - Veneer:AddHandler(self, self.anchorPoint, true) + self:RegisterEvent('ITEM_LOCK_CHANGED') -- use to clear bag slot cache data + Veneer:AddHandler(self, self.anchorPoint, 2) SLASH_VENEER_AP1 = "/vap" SLASH_VENEER_AP2 = "/veneerap" SlashCmdList.VENEER_AP = function(arg) @@ -62,7 +63,13 @@ end self:Print('Show Underlight Angler:', (VeneerData.ArtifactPower.EnableFishing and 'ON' or 'OFF')) self:Update() - + elseif arg == 'reset' then + if self.db then + table.wipe(self.db.cache) + table.wipe(self.db.fishingCache) + end + self:Print('Cache data reset.') + self:Update() else self:Show() end @@ -73,6 +80,15 @@ end +local ShortNumberString = function (value) + if value >= 100000 then + return tostring(floor(value/1000)) .. 'k' + elseif value >= 1000 then + return tostring(floor(value/100)/10) .. 'k' + else + return value + end +end local IsBagnonOpen = function() @@ -150,11 +166,16 @@ end - self.cache = self.db.cache self.profile = self.db[guid] + self.profile.cache = self.profile.cache or {} + self.profile.cache.bagItems = self.profile.cache.bagItems or {} + self.profile.cache.bags = self.profile.cache.bags or {} + self.profile.cache.fishing = self.profile.cache.fishing or {} + self.profile.cache.items = self.profile.cache.items or {} self.profile.bagslots = self.profile.bagslots or {} self.profile.artifacts = self.profile.artifacts or {} self.updateSummary = true + self.cache = self.profile.cache VeneerArtifactPowerTimer:SetScript('OnUpdate', function() self:OnUpdate() @@ -282,7 +303,19 @@ self:TryToShow() elseif event == 'BAG_UPDATE' then local containerID = ... + + self:QueueBag(containerID) + elseif event == 'ITEM_LOCK_CHANGED' then + + local containerID, slotID = ... + + if self.cache.bags[containerID] and self.cache.bags[containerID][slotID] then + self.cache.bags[containerID][slotID] = nil + self.cache.fishing[containerID][slotID] = nil + end + + elseif event == 'PLAYER_BANKSLOTS_CHANGED' then self:ScanAllBags() elseif event == 'BAG_UPDATE_DELAYED' then @@ -359,23 +392,29 @@ end end end - if self.fishingAP and self.fishingAP >= 1 then + if self.fishingAP and self.fishingAP > 0 then bankText = (bankText and (bankText .. ' ') or '') .. '|cFF0088FF' .. tostring(self.fishingAP) .. ' fishing AP|r' end self.SummaryHeader:SetText(bankText) local numButtons = 0 - local contentsHeight = 64 + local contentsHeight = 16 + self.SummaryHeader:GetHeight() + 64 + local contentsWidth = 64 if self.profile.knowledgeMultiplier then numButtons = self:UpdateArtifactButtons() - contentsHeight = contentsHeight + self:UpdateItemButtons() + + contentsWidth = 64*numButtons + 4 * (numButtons+1) + + local itemsWidth, itemsHeight = self:UpdateItemButtons() + contentsHeight = contentsHeight + itemsHeight + contentsWidth = max(contentsWidth, itemsWidth) end - self:SetWidth(64*numButtons + 4 * (numButtons+1)) - self:SetHeight(16 + self.SummaryHeader:GetHeight() + contentsHeight) + self:SetWidth(contentsWidth) + self:SetHeight(contentsHeight) self:Reanchor() end @@ -395,15 +434,17 @@ end else - numButtons = numButtons + 1 - button = self.Artifact[numButtons] - button.relativeFrame = lastFrame - lastFrame = button:SetButton(itemID, artifact, numButtons, (self.equippedID == itemID)) + if artifact.level ~= 54 then + numButtons = numButtons + 1 + button = self.Artifact[numButtons] + button.relativeFrame = lastFrame + lastFrame = button:SetButton(itemID, artifact, numButtons, (self.equippedID == itemID)) + end end end - if fishingData then + if fishingData and (self.fishingAP and self.fishingAP > 0) then numButtons = numButtons + 1 local button = self.Artifact[numButtons] button.relativeFrame = lastFrame @@ -424,7 +465,7 @@ local lastFrame, upFrame local numButtons = 0 local buttonsHeight = 0 - local buttonWidth = 0 + local buttonsWidth = 0 for index, button in ipairs(self.Tokens) do if button.numItems >= 1 then if button.itemName then @@ -438,12 +479,19 @@ button:SetPoint('TOPLEFT', self, 'TOPLEFT', 4, -76) upFrame = button buttonsHeight = 52 - elseif mod(numButtons,8) == 1 then - button:SetPoint('TOPLEFT', upFrame, 'BOTTOMLEFT', 0, -2) - upFrame = button - buttonsHeight = buttonsHeight + 52 + buttonsWidth = 50 else - button:SetPoint('TOPLEFT', lastFrame, 'TOPRIGHT', 2, 0) + local col = mod(numButtons,8) + if col == 1 then + button:SetPoint('TOPLEFT', upFrame, 'BOTTOMLEFT', 0, -2) + upFrame = button + buttonsHeight = buttonsHeight + 52 + + else + button:SetPoint('TOPLEFT', lastFrame, 'TOPRIGHT', 2, 0) + + end + buttonsWidth = max(buttonsWidth, col * 50) end button.Count:SetText(button.numItems) lastFrame = button @@ -455,7 +503,7 @@ - return buttonsHeight + return buttonsWidth, buttonsHeight end function ap:SetItemAction(button, name) @@ -490,7 +538,7 @@ self.numItems = self.numItems + 1 end - local itemAPtext = itemAP * self.profile.knowledgeMultiplier + local itemAPtext = itemAP if itemAPtext >= 100000 then itemAPtext = floor(itemAPtext/1000) .. 'k' elseif itemAPtext >= 1000 then @@ -503,7 +551,7 @@ end function ap:GetItemAP(itemID, itemLink, bagData) - if not self.cache[itemID] then + if not self.cache.items[itemID] then print('doing tooltip scan') self.tooltip:SetOwner(self, 'ANCHOR_NONE') @@ -520,8 +568,8 @@ print(itemLink, '-', tonumber(text)) local itemAP = tonumber(text) if itemAP then - itemAP = itemAP / self.profile.knowledgeMultiplier - self.cache[itemID] = itemAP + itemAP = itemAP + self.cache.items[itemID] = itemAP end end end @@ -531,16 +579,16 @@ local fishingAP = fishingText:match("%d+") fishingAP = tonumber(fishingAP) if fishingAP then - self.cache[itemID] = fishingAP - self.fishingCache[itemID] = true + self.cache.items[itemID] = fishingAP + self.cache.fishing[itemID] = true end end else - self.cache[itemID] = 0 + self.cache.items[itemID] = 0 end end - return self.cache[itemID], self.fishingCache[itemID] + return self.cache.items[itemID], self.cache.fishing[itemID] end function ap:SetArtifact(itemID, name, texture, currentXP, pointsSpent) @@ -551,6 +599,11 @@ local artifacts = self.profile.artifacts local multi = C_ArtifactUI.GetArtifactKnowledgeMultiplier() + if multi and (self.profile.knowledgeMultiplier ~= multi) then + table.wipe(self.cache.items) + table.wipe(self.cache.fishing) + end + self.profile.knowledgeMultiplier = multi or self.profile.knowledgeMultiplier print('multiplier:', multi) @@ -567,7 +620,7 @@ artifact.currentXP = currentXP artifact.level = pointsSpent local cost = C_ArtifactUI.GetCostForPointAtRank(pointsSpent) - artifact.cost = cost + artifact.currentCost = cost local pointsAvailable = pointsSpent local actualCost = cost @@ -603,6 +656,10 @@ bagData.items = bagData.items or {} table.wipe(bagData.items) + self.cache.bagItems[id] = self.cache.bagItems[id] or {} + self.cache.bags[id] = self.cache.bags[id] or {} + self.cache.fishing[id] = self.cache.fishing[id] or {} + for slotID = 1, numSlots do local texture, count, locked, quality, readable, lootable, link = GetContainerItemInfo(id, slotID) if link then @@ -611,7 +668,18 @@ if class == 'Consumable' and subclass == 'Other' then --print(GetItemInfo(link)) - local itemAP, isFishingAP = self:GetItemAP(itemID, link) + local itemAP, isFishingAP + if self.cache.bags[id][slotID] and (self.cache.bagItems[id][slotID] == itemID) then + print('slot cache data', id, slotID) + itemAP = self.cache.bags[id][slotID] + else + itemAP, isFishingAP = self:GetItemAP(itemID, link) + self.cache.bagItems[id][slotID] = itemID + self.cache.bags[id][slotID] = itemAP + self.cache.fishing[id][slotID] = isFishingAP + end + + --print(itemAP, isFishingAP) if itemAP and (itemAP > 0) then local itemButton = self:GetItemButton(itemID, texture, itemAP) @@ -620,7 +688,7 @@ bagData.fishingItems = (bagData.fishingItems or 0) + 1 bagData.fishingAP = (bagData.fishingAP or 0) + itemAP else - itemAP = itemAP * self.profile.knowledgeMultiplier + itemAP = itemAP bagData.numItems = (bagData.numItems or 0) + 1 bagData.totalAP = (bagData.totalAP or 0) + itemAP end @@ -701,6 +769,10 @@ print(itemID, index) print(artifact.name, artifact.texture, artifact.currentXP) self:SetID(itemID) + if not artifact.currentCost then + artifact.currentCost = artifact.cost + end + for k,v in pairs(artifact) do --print('::',k,v) self[k] = v @@ -724,7 +796,10 @@ self.potentialLevel = potentialPoints self.potentialAdjustedXP = potentialXP - + self.maxCost = self.currentCost + for i = self.level + 1, #POINT_COSTS do + self.maxCost = self.maxCost + POINT_COSTS[i] + end if index ~= 1 then self:ClearAllPoints() @@ -741,12 +816,11 @@ end function VeneerArtifactButtonMixin:Update() - local r, g, b = 1, 1, 1 local lR, lG, lB = 1, 1, 0 local levelText = self.level local xpValue = self.currentXP - local costValue = self.cost + local costValue = self.currentCost if self.actualLevel ~= self.level then levelText, r,g,b = self.actualLevel, 0,1,0 xpValue, costValue, lR, lG, lB = self.actualXP, self.actualCost, 0, 1, 0 @@ -756,21 +830,9 @@ end - if xpValue >= 100000 then - xpValue = tostring(floor(xpValue/1000))..'k' - elseif xpValue > 1000 then - xpValue = tostring(floor(xpValue/100)/10)..'k' - end - if costValue >= 100000 then - costValue = tostring(floor(costValue/1000))..'k' - elseif costValue >= 1000 then - costValue = tostring(floor(costValue/100)/10)..'k' - end - - self.Level:SetText(levelText) self.Level:SetTextColor(r, g, b) - self.CurrentXP:SetText(xpValue) + self.CurrentXP:SetText(ShortNumberString( xpValue)) self.CurrentXP:SetTextColor(lR, lG, lB) if self.isEquipped then @@ -781,9 +843,8 @@ self:SetNormalTexture(nil, 'ADD') end - local currentProgress = (self.currentXP < self.cost) and (self.currentXP / self.cost) or 1 + local currentProgress = (self.currentXP < self.currentCost) and (self.currentXP / self.currentCost) or 1 if self.level <= 53 then - self.CurrentProgress.animateFrom = self.CurrentProgress:GetHeight() or 1 self.CurrentProgress.animateTo = currentProgress * self:GetHeight() self.CurrentProgress:Show() @@ -795,26 +856,21 @@ if self.potentialXP > self.currentXP then local projectedProgress = (self.potentialAdjustedXP < self.potentialCost) and (self.potentialXP / self.potentialCost) or 1 - if (projectedProgress > currentProgress) then self.AdjustedProgress:SetPoint('BOTTOM', self.CurrentProgress, 'TOP') projectedProgress = projectedProgress - currentProgress - else self.AdjustedProgress:SetPoint('BOTTOM', self, 'BOTTOM') end print('show potential', currentProgress, projectedProgress) self.AdjustedProgress.animateFrom = self.AdjustedProgress:GetHeight() or 1 self.AdjustedProgress.animateTo = projectedProgress * self:GetHeight() - self.AdjustedLine:Show() self.AdjustedProgress:Show() else self.AdjustedProgress:Hide() self.AdjustedLine:Hide() end - - self.Icon:SetTexture(self.texture) self:SetSize(64,64) end @@ -848,21 +904,23 @@ if self.AdjustedProgress.animateTo then self:AnimateProgress(self.AdjustedProgress) end - end function VeneerArtifactButtonMixin:OnEnter() GameTooltip:SetOwner(self, 'ANCHOR_CURSOR') GameTooltip:SetText(self.name) - GameTooltip:AddLine(tostring(self.currentXP) .. ' / '..tostring(self.cost), 1, 1, 0) + GameTooltip:AddLine(ShortNumberString(self.currentXP) .. ' / '..ShortNumberString(self.currentCost), 1, 1, 0) if self.potentialXP > self.currentXP then - GameTooltip:AddLine(tostring(self.potentialXP) .. ' potential XP', 0, 1, 1) + GameTooltip:AddLine(ShortNumberString(self.potentialXP) .. ' potential XP', 0, 1, 1) if self.potentialAdjustedXP ~= self.potentialXP then - GameTooltip:AddLine(tostring(self.potentialAdjustedXP) .. ' / ' .. tostring(self.potentialCost).. ' after', 0, 1, 0) + GameTooltip:AddLine(ShortNumberString(self.potentialAdjustedXP) .. ' / ' .. ShortNumberString(self.potentialCost).. ' after', 0, 1, 0) end end if self.actualLevel ~= self.level then - GameTooltip:AddLine(tostring(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 1) + GameTooltip:AddLine(ShortNumberString(self.actualLevel - self.level) .. ' points unlocked', 0, 1, 1) + end + if self.currentXP < self.currentCost then + GameTooltip:AddLine(ShortNumberString(self.currentCost - self.currentXP) .. ' needed') end GameTooltip:Show() @@ -872,11 +930,21 @@ GameTooltip:Hide() end end +function VeneerArtifactButtonMixin:OnHide() + + if GameTooltip:IsOwned(self) then + GameTooltip:Hide() + end +end function VeneerArtifactButtonMixin:OnClick(button, down) if self.isEquipped then SocketInventoryItem(16) else + if IsShiftKeyDown() then SocketContainerItem(self.containerID, self.slotID) + else + + end end end \ No newline at end of file
--- a/Modules/ArtifactPower.xml Sun Jan 29 09:57:09 2017 -0500 +++ b/Modules/ArtifactPower.xml Sat Feb 25 11:42:07 2017 -0500 @@ -76,7 +76,7 @@ <Texture parentKey="AdjustedLine"> <Size y="1" /> <Anchors> - <Anchor point="BOTTOM" relativePoint="TOP" relativeKey="$parent.AdjustedProgress" /> + <Anchor point="TOP" relativeKey="$parent.AdjustedProgress" /> <Anchor point="RIGHT" relativeKey="$parent.AdjustedProgress" /> <Anchor point="LEFT" relativeKey="$parent.AdjustedProgress" /> </Anchors> @@ -95,7 +95,7 @@ </Layers> </Button> <Frame name="VeneerArtifactPowerTimer" parent="UIParent" /> - <Frame name="VeneerArtifactPower" hidden="true" mixin="VeneerArtifactPowerMixin" parent="UIParent" inherits="VeneerMixinScripts" enableMouse="true"> + <Frame name="VeneerArtifactPower" hidden="true" mixin="VeneerArtifactPowerMixin" parent="UIParent" inherits="VeneerHandlerTemplate" enableMouse="true"> <Size x="300" y="36" /> <Scripts> <OnEnter method="OnEnter" />
--- a/Modules/BuffFrame.lua Sun Jan 29 09:57:09 2017 -0500 +++ b/Modules/BuffFrame.lua Sat Feb 25 11:42:07 2017 -0500 @@ -389,8 +389,10 @@ frame.count:SetText('test') frame.count:Show() end - --]] - local name, rank, icon, count, _, duration, expires = UnitAura(frame.unit, frame:GetID(), frame.filter) + --]] + + local name, rank, icon, count, dispelType, duration, expires, caster, isStealable, nameplateShowPersonal, spellID, canApplyAura, isBossDebuff, _, nameplateShowAll, timeMod, value1, value2, value3 = UnitAura(frame.unit, frame:GetID(), frame.filter) + if expires and duration then @@ -420,6 +422,29 @@ else self.fg:SetWidth(nw) end + + + if value1 then + facade.overlay.Value1:Show() + facade.overlay.Value1:SetText(value1) + else + facade.overlay.Value1:Hide() + end + + if value2 then + facade.overlay.Value2:Show() + facade.overlay.Value2:SetText(value2) + else + facade.overlay.Value2:Hide() + end + + if value3 then + facade.overlay.Value3:Show() + facade.overlay.Value3:SetText(value3) + else + facade.overlay.Value3:Hide() + end + end) facade.cooldown:Show()
--- a/Modules/BuffFrame.xml Sun Jan 29 09:57:09 2017 -0500 +++ b/Modules/BuffFrame.xml Sat Feb 25 11:42:07 2017 -0500 @@ -67,6 +67,24 @@ <Anchor point="TOPRIGHT" x="-2" y="-2" /> </Anchors> </FontString> + <FontString name="$parentValue1" parentKey="Value1" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="TOPLEFT" x="2" y="-2" /> + </Anchors> + <Color r="0" g="1" b="0" /> + </FontString> + <FontString name="$parentValue2" parentKey="Value2" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="TOPLEFT" x="0" y="-2" relativeTo="BOTTOMELFT" relativeKey="$parent.Value1" /> + </Anchors> + <Color r="0" g="1" b="1" /> + </FontString> + <FontString name="$parentValue3" parentKey="Value3" inherits="VeneerNumberFont"> + <Anchors> + <Anchor point="TOPLEFT" x="0" y="-2" relativeTo="BOTTOMELFT" relativeKey="$parent.Value1" /> + </Anchors> + <Color r="1" g="1" b="0" /> + </FontString> </Layer> </Layers> </Frame>
--- a/Modules/GuildInfo.lua Sun Jan 29 09:57:09 2017 -0500 +++ b/Modules/GuildInfo.lua Sat Feb 25 11:42:07 2017 -0500 @@ -1,3 +1,6 @@ + +local print = DEVIAN_WORKSPACE and function(...) print('VnRoster', ...) end or nop + VeneerRosterKunMixin = { addonTrigger = 'Blizzard_GuildUI', @@ -9,14 +12,52 @@ local module = VeneerRosterKunMixin function module:OnLoad() - Veneer:AddHandler(self, self.anchorPoint) - self:RegisterEvent('GUILD_ROSTER_UPDATE') self:RegisterEvent('GUILD_TRADESKILL_UPDATE') + + self:RegisterEvent('LFG_LIST_SEARCH_RESULT_UPDATED') + self:RegisterEvent('LFG_LIST_SEARCH_RESULTS_RECEIVED') + self:RegisterEvent('LFG_LIST_AVAILABILITY_UPDATE') + self:RegisterEvent('LFG_LIST_LOCK_INFO_RECEIVED') end -function module:OnEvent() +function module:Setup() + VeneerHandlerMixin.Setup(self) + self:SetParent(GuildFrame) + self:SetShown(true) +end +function module:SetDirty() + if self:IsVisible() then + self:Update() + else + self.GuildInfoDirty = true + end +end +function module:OnShow() + print('|cFF00FFFFOnShow()|r') + if self.GuildInfoDirty then + self:UpdateGuildInfo() + end +end + +function module:UpdateGuildInfo() + local numMembers = GetNumGuildMembers() + print(numMembers) + for i = 1, numMembers do + print(GetGuildRosterInfo(i)) + end +end + +function module:Update() end + +function module:OnEvent(event, ...) + print('|cFFFF0088OnEvent()|r', event, ...) + if event == 'LFG_LIST_SEARCH_RESULTS_RECEIVED' then + elseif event == 'LFG_LIST_SEARCH_RESULT_UPDATED' then + elseif event == 'GUILD_ROSTER_UPDATE' then + self:SetDirty() + end end \ No newline at end of file
--- a/Modules/WorldState.lua Sun Jan 29 09:57:09 2017 -0500 +++ b/Modules/WorldState.lua Sat Feb 25 11:42:07 2017 -0500 @@ -75,7 +75,7 @@ self:RegisterEvent('PLAYER_ENTERING_WORLD') self:RegisterEvent('PLAYER_REGEN_ENABLED') self:RegisterEvent('PLAYER_REGEN_DISABLED') - Veneer:AddHandler(self, self.anchorPoint, true) + Veneer:AddHandler(self, self.anchorPoint, 2) SLASH_VENEERWORLDSTATE1 = "/vws" SLASH_VENEERWORLDSTATE2 = "/worldstate" SlashCmdList.VENEERWORLDSTATE = function() @@ -86,12 +86,11 @@ function VeneerWorldStateMixin:OnEvent(event, arg) print(event, arg) if event == 'PLAYER_ENTERING_WORLD' then - self:Show() self:Update() elseif event == 'PLAYER_REGEN_ENABLED' then - self:SetShown(true) + self:Update(true) elseif event == 'PLAYER_REGEN_DISABLED' then - self:SetShown(false) + self:Update(true) end end @@ -106,13 +105,17 @@ end end +function VeneerWorldStateMixin:OnShow() + print('OnShow()', debugstack()) +end + function VeneerWorldStateMixin:Reanchor(isUpdate) print(' |cFF0088FF'..self:GetName()..':Reanchor()|r', #self.modules, 'blocks') self.maxHeight = 0 local lastFrame for i, frame in ipairs(self.modules) do - print(' '..frame:GetName()..':',frame:IsShown(), frame:IsVisible(), frame:GetHeight()) - if frame:IsVisible() then + print(' '..frame:GetName()..':',frame:IsShown(), frame:GetHeight()) + if frame:IsShown() then if lastFrame then frame:SetPoint('TOP', lastFrame, 'BOTTOM') else @@ -123,13 +126,13 @@ lastFrame = frame end end - if self.maxHeight == 0 then - print (' hiding because there are no blocks') - self:Hide() + if (self.maxHeight == 0) or InCombatLockdown() then + print (' hiding; combat =', InCombatLockdown()) + self:SetShown(false) else - self:Show() print (' height update:', self.maxHeight) self:SetHeight(self.maxHeight) + self:SetShown(true) end if not isUpdate then @@ -155,7 +158,7 @@ end function VeneerOrderHallMixin:OnLoad() - Veneer:AddHandler(self, 'TOP', true) + Veneer:AddHandler(self, 'TOP', 1) end function VeneerOrderHallMixin:OnEvent(event, ...) @@ -187,7 +190,7 @@ end OrderHallCommandBar:ClearAllPoints() - OrderHallCommandBar:SetPoint('TOP', UIParent, 'TOP') + OrderHallCommandBar:SetAllPoints(self) OrderHallCommandBar:SetWidth(600) OrderHallCommandBar.Background:SetColorTexture(0,0,0,0.5) OrderHallCommandBar.WorldMapButton:Hide()
--- a/Templates.lua Sun Jan 29 09:57:09 2017 -0500 +++ b/Templates.lua Sat Feb 25 11:42:07 2017 -0500 @@ -11,6 +11,7 @@ VeneerAnimationMixin = {} VeneerHandlerMixin = { anchorPoint = 'CENTER', + anchorPriority = 4, data = {}, }
--- a/Veneer.lua Sun Jan 29 09:57:09 2017 -0500 +++ b/Veneer.lua Sat Feb 25 11:42:07 2017 -0500 @@ -211,7 +211,7 @@ function VeneerCore:GetClusterFromArgs (...) local primaryAnchor local insertPosition - + local insertPriority local clusterTable = self.FrameClusters @@ -226,25 +226,57 @@ clusterTable = clusterTable[arg] print(strrep(' ', i)..'anchor cluster', i, arg) elseif argType == 'boolean' then - insertPosition = 1 + if arg == true then + print('force top position') + insertPosition = 1 + insertPriority = nil + end + elseif argType == 'number' then + insertPriority = arg end end + + if insertPriority then + for i = 1, #clusterTable do + if clusterTable[i].anchorPriority and (clusterTable[i].anchorPriority > insertPriority) then + print('prioritized insert position:', insertPriority, insertPosition) + break + else + print('passing lower priority frame:', clusterTable[i]:GetName()) + end + insertPosition = i + end + end + + if not primaryAnchor then primaryAnchor = 'CENTER' clusterTable[primaryAnchor] = clusterTable[primaryAnchor] or {} clusterTable = clusterTable[primaryAnchor] + print('using default anchor') end + if not insertPosition then insertPosition = #clusterTable + 1 + print('using default position') end return primaryAnchor, clusterTable, insertPosition end +-- args: frame object, list of anchor groups, true for forced top, number for priority layer function VeneerCore:AddHandler(handler, ...) print('|cFFFFFF00*** Adding handler:', handler.moduleName or handler:GetName()) + + for k,v in pairs(VeneerHandlerMixin) do + if not handler[k] then + print(' * from mixin:', k) + handler[k] = v + end + end + if not handler.anchorFrame then - local anchorGroup, clusterTable, clusterIndex = self:GetClusterFromArgs(...) + local anchorGroup, clusterTable, clusterIndex, clusterPriority = self:GetClusterFromArgs(...) if clusterIndex == 1 then for i, frame in ipairs(clusterTable) do frame.clusterIndex = i + 1 @@ -263,13 +295,6 @@ print(' free frame') end - for k,v in pairs(VeneerHandlerMixin) do - if not handler[k] then - print(' * from mixin:', k) - handler[k] = v - end - end - if handler.addonTrigger and not IsAddOnLoaded(handler.addonTrigger) then print('|cFFFF4400 -- dependency:', handler.addonTrigger) self.AddOnCheck[handler.addonTrigger] = self.AddOnCheck[handler.addonTrigger] or {} @@ -322,8 +347,8 @@ if anchorPoint ~= LE_FREE_FRAMES_GROUP then local lastFrame for index, frame in ipairs(cluster) do - print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent')) - if frame:IsVisible() then + print(' |cFF00FF00'..index, frame:GetName(), frame:IsShown(), (lastFrame and ('|cFFFFFF00'..lastFrame:GetName()..'|r') or '|cFF00FFFFUIParent')) + if frame:IsShown() then if frame.anchorFrame then print(frame.anchorPoint) @@ -364,7 +389,7 @@ local nextFrame for index, frame in ipairs(handler.anchorCluster) do print(' |cFF00FF00'..index, frame:GetName(), frame:IsVisible()) - if frame:IsVisible() then + if frame:IsShown() then if frame ~= handler then anchorParent = frame anchorTo = ANCHOR_OFFSET_POINT[anchorPoint] @@ -384,7 +409,7 @@ end end - if handler:IsVisible() then + if handler:IsShown() then handler:SetPoint(anchorPoint, anchorParent, anchorTo, 0, 0) else if anchorParent and nextFrame then