This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Minimap.lua
50 lines (47 loc) · 1.59 KB
/
Minimap.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
local addonName, addon = ...;
local module = addon:RegisterModule("Minimap");
local function updatePosition(button)
local position = addon.Variables.user.minimapPosition;
local angle = math.rad(position or 90);
local x, y = math.cos(angle), math.sin(angle);
local radius = 5;
local width = (Minimap:GetWidth() / 2) + radius;
local height = (Minimap:GetHeight() / 2) + radius;
x, y = x * width, y * height;
button:SetPoint("CENTER", Minimap, "CENTER", x, y);
end
function GatherPanel_Minimap_ResetButtonPosition(button)
if addon.Variables.user.minimapPosition == nil then
addon.Variables.user.minimapPosition = 90;
end
button:ClearAllPoints()
updatePosition(button)
end
AddonCompartmentFrame:RegisterAddon({
text = addonName,
icon = "Interface\\Icons\\inv_misc_treasurechest05c",
registerForAnyClick = true,
notCheckable = true,
func = function(btn, arg1, arg2, checked, mouseButton)
if mouseButton == "LeftButton" then
if IsShiftKeyDown() then
addon.Settings:Open();
else
GatherPanel:SetShown(not GatherPanel:IsShown());
end
elseif mouseButton == "RightButton" then
GatherPanel_ToggleTracker();
end
end,
funcOnEnter = function()
GameTooltip:SetOwner(AddonCompartmentFrame, "ANCHOR_TOPRIGHT")
GameTooltip:SetText(format("GatherPanel v%i.%i.%i",
GATHERPANEL_VERSION.major,
GATHERPANEL_VERSION.minor,
GATHERPANEL_VERSION.patch
))
GameTooltip:AddLine(
"Left Click to toggle panel.\nRight click to toggle tracker overlay.\nShift-Left Click to open settings.", 0, 1, 0)
GameTooltip:Show()
end,
});