comparison ObjectiveTracker/Widgets.lua @ 35:69d03f8e293e

- separated layout and data logic between Frame.lua and Update.lua - solved disappearing tracker mystery
author Nenue
date Sun, 17 Apr 2016 11:07:48 -0400
parents 9856ebc63fa4
children e84d645c8ab8
comparison
equal deleted inserted replaced
34:9856ebc63fa4 35:69d03f8e293e
443 self.height = 0 443 self.height = 0
444 end 444 end
445 T.UpdateWidget.Hidden = function (self) 445 T.UpdateWidget.Hidden = function (self)
446 self.height= 0 446 self.height= 0
447 end 447 end
448
449
450 --- Queue any active item buttons for update for that frame
451 local iprint = B.print('ItemButton')
452 local Quest = T.Quest
453 local IsQuestWatched, InCombatLockdown = IsQuestWatched, InCombatLockdown
454 T.UpdateActionButtons = function(updateReason)
455 local print = iprint
456 Scroller.snap_upper = 0
457 Scroller.snap_lower = 0
458 local print = B.print('ItemButton')
459 if updateReason then
460 print = B.print('IB_'..updateReason)
461 end
462
463 local previousItem
464 for questID, itemButton in pairs(Quest.itemButtons) do
465 local info= T.Quest.Info[questID]
466
467 print('|cFF00FFFF'.. questID .. '|r', itemButton:GetName())
468 local block = T.Quest.QuestBlock[questID]
469 if block then
470 -- Dispatch the probe
471 if IsQuestWatched(info.logIndex) then
472 itemButton.previousItem = previousItem
473 print(' |cFFFFFF00probing', block:GetName())
474 block:SetScript('OnUpdate', function()
475 if block:GetBottom() and not InCombatLockdown() then
476 print(' '..block:GetName()..' |cFF00FF00probe hit!')
477 T.UpdateBlockAction(block, itemButton, itemButton.previousItem) -- needs to be previousItem from this scope
478 block:SetScript('OnUpdate', nil)
479
480 end
481 end)
482 previousItem = itemButton
483 else
484 print('hidden block or unwatched quest')
485 itemButton.previousItem = nil
486 itemButton:Hide()
487 end
488 elseif itemButton:IsVisible() then
489 print(' |cFFFF0088hiding unwatched quest button', itemButton:GetName())
490 itemButton.previousItem = nil
491 itemButton:Hide()
492 else
493 print(' |cFFBBBBBBignoring hidden log quest button', itemButton:GetName())
494 end
495 end
496 end