You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.6 KiB

3 years ago
local E, L, V, P, G = unpack(ElvUI)
local B = E:GetModule('Blizzard')
local _G = _G
local min = min
local CreateFrame = CreateFrame
local hooksecurefunc = hooksecurefunc
local Tracker_Collapse = WatchFrame_Collapse
local Tracker_Expand = WatchFrame_Expand
local Tracker = WatchFrame
local function ObjectiveTracker_SetPoint(tracker, _, parent)
if parent ~= tracker.holder then
tracker:ClearAllPoints()
tracker:SetPoint('TOP', tracker.holder)
end
end
function B:ObjectiveTracker_SetHeight()
local top = Tracker:GetTop() or 0
local gapFromTop = E.screenHeight - top
local maxHeight = E.screenHeight - gapFromTop
local frameHeight = min(maxHeight, E.db.general.objectiveFrameHeight)
3 years ago
Tracker:Height(frameHeight)
3 years ago
end
function B:ObjectiveTracker_AutoHideOnHide()
if not Tracker.collapsed then
Tracker.userCollapsed = true
Tracker_Collapse(Tracker)
end
end
3 years ago
function B:ObjectiveTracker_AutoHideOnShow()
if Tracker.collapsed then
Tracker.userCollapsed = nil
Tracker_Expand(Tracker)
3 years ago
end
end
function B:ObjectiveTracker_Setup()
3 years ago
local holder = CreateFrame('Frame', 'ObjectiveFrameHolder', E.UIParent)
holder:Point('TOPRIGHT', E.UIParent, -135, -300)
3 years ago
holder:Size(130, 22)
E:CreateMover(holder, 'ObjectiveFrameMover', L["Objective Frame"], nil, nil, nil, nil, nil, 'general,blizzUIImprovements')
holder:SetAllPoints(_G.ObjectiveFrameMover)
Tracker:SetClampedToScreen(false)
Tracker:ClearAllPoints()
Tracker:SetPoint('TOP', holder)
3 years ago
Tracker.holder = holder
hooksecurefunc(Tracker, 'SetPoint', ObjectiveTracker_SetPoint)
3 years ago
B:ObjectiveTracker_AutoHide() -- supported but no boss frames, only works for arena
B:ObjectiveTracker_SetHeight()
3 years ago
end