BrokerDisplayMap/minimap.lua

87 lines
3.3 KiB
Lua

local addonName, addon = ...
local childName = addon['childName']
local child = addon[childName]
local frame = CreateFrame("FRAME", addonName, MinimapCluster)
function frame:updatePosition()
self:SetAllPoints(MinimapCluster)
self:Show()
MinimapBorderTop:Hide()
MinimapZoneTextButton:Hide()
GameTimeFrame:Hide()
MinimapBackdrop:Hide()
MinimapCluster:SetWidth(240)
MinimapCluster:SetHeight(200)
Minimap:SetWidth(122)
Minimap:SetHeight(122)
BuffFrame:SetPoint("TOPRIGHT", self, "TOPLEFT", -9, 0)
if(ObjectiveTrackerFrame and ObjectiveTrackerFrame:IsVisible() and not ObjectiveTrackerFrame:IsUserPlaced() and not InCombatLockdown()) then
ObjectiveTrackerFrame:SetMovable(true)
ObjectiveTrackerFrame:SetUserPlaced(true)
ObjectiveTrackerFrame:SetPoint("TOPRIGHT", MinimapCluster, "BOTTOMRIGHT")
end
end
frame:SetScript("OnEvent", function(self, event)
if(event == "PLAYER_ENTERING_WORLD") then
self:updatePosition(self)
elseif(event == "UNIT_AURA") then
BuffFrame:SetPoint("TOPRIGHT", self,"TOPLEFT", -9, 0)
end
end)
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:RegisterUnitEvent("UNIT_AURA","player")
Minimap:EnableMouseWheel(true)
local ping = Minimap:GetScript("OnMouseUp")
Minimap:SetScript("OnMouseUp", nil)
Minimap:HookScript("OnMouseWheel", function(self, delta)
self:SetZoom(self:GetZoom() + delta);
end)
Minimap:HookScript("OnMouseDown", function(self,button)
if(button == 'RightButton') then
ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, self, 0, -5)
else
ping(self, button)
end
end)
local init = {
Setup = function(self)
Minimap:ClearAllPoints()
Minimap:SetPoint("CENTER")
local mix = BackdropTemplateMixin and "BackdropTemplate" or nil
if(mix) then
Mixin(Minimap, BackdropTemplateMixin)
Mixin(Minimap:GetParent(), BackdropTemplateMixin)
end
Minimap:SetMaskTexture(format("Interface\\AddOns\\%s\\minimapmask.tga",addonName))
Minimap:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/DialogFrame/UI-DialogBox-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
Minimap:GetParent():SetBackdrop({
bgFile = "Interface/DialogFrame/UI-DialogBox-Background-Dark",
edgeFile = "Interface/DialogFrame/UI-DialogBox-Gold-Border",
tile = true, tileSize = 16, edgeSize = 16,
insets = { left = 4, right = 4, top = 4, bottom = 4 }
})
frame:updatePosition()
--[[ addon['db']['profile'][name][name..'Settings'] = addon['db']['profile'][name][name..'Settings'] or {
[name] = {
['xpos'] = 0,
['ypos'] = 0,
}
}
db = addon['db']['profile'][name][name..'Settings']
]]
-- frame['db'] = db
-- frame['dragAble'] = function() return not addon['db']['profile']['lockwindow'] end
-- MinimapCluster:SetParent(frame)
-- MinimapCluster['db'] = db
-- MinimapCluster['dragAble'] = function() return not addon['db']['profile']['lockwindow'] end
-- addon:CreateSecureFrame(MinimapCluster)
-- addon:AddConfigEntry(name,'toggle','lockwindow',"Lock","Lock window",1)
end
}
addon.RegisterCallback(init, format("Init%s", childName), 'Setup')