-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFineTuneHUD.lua
More file actions
146 lines (135 loc) · 6.03 KB
/
FineTuneHUD.lua
File metadata and controls
146 lines (135 loc) · 6.03 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
local _, core = ...; -- Namespace
local FineTune = {};
core.FineTune = FineTune;
core.frames = {
extraAbilityContainer = _G["ExtraAbilityContainer"],
targetFrame = _G["TargetFrame"],
talkingHeadFrame = _G["TalkingHeadFrame"],
partyFrame = _G["PartyFrame"],
combatRaidFrameContainer = _G["CompactRaidFrameContainer"],
debuffFrame = _G["DebuffFrame"],
possessActionBar = _G["PossessActionBar"],
playerFrame = _G["PlayerFrame"],
chatFrame1 = _G["ChatFrame1"],
mainMenuBarVehicleLeaveButton = _G["MainMenuBarVehicleLeaveButton"],
playerCastingBarFrame = _G["PlayerCastingBarFrame"],
stanceBar = _G["StanceBar"],
petActionBar = _G["PetActionBar"],
mainMenuBar = _G["MainMenuBar"],
multiBarBottomLeft = _G["MultiBarBottomLeft"],
multiBar7 = _G["MultiBar7"],
multiBar6 = _G["MultiBar6"],
multiBar5 = _G["MultiBar5"],
multiBarBottomRight = _G["MultiBarBottomRight"],
multiBarRight = _G["MultiBarRight"],
multiBarLeft = _G["MultiBarLeft"],
mainStatusTrackingBarContainer = _G["MainStatusTrackingBarContainer"],
secondaryStatusTrackingBarContainer = _G["SecondaryStatusTrackingBarContainer"],
petFrame = _G["PetFrame"],
objectiveTrackerFrame = _G["ObjectiveTrackerFrame"],
buffFrame = _G["BuffFrame"],
minimapCluster = _G["MinimapCluster"],
bossTargetFrameContainer = _G["BossTargetFrameContainer"],
durabilityFrame = _G["DurabilityFrame"],
arenaEnemyFramesContainer = _G["ArenaEnemyFramesContainer"],
gameTolltipDefaultContainer = _G["GameTooltipDefaultContainer"],
bagsBar = _G["BagsBar"],
microMenuContainer = _G["MicroMenuContainer"],
lootFrame = _G["LootFrame"],
focusFrame = _G["FocusFrame"],
mirrorTimerContainer = _G["MirrorTimerContainer"],
archeologyDigsiteProgressBar = _G["ArcheologyDigsiteProgressBar"],
vehicleSeatIndicator = _G["VehicleSeatIndicator"],
}
local updateEventFrame = CreateFrame("Frame");
local settingDialog = _G["EditModeSystemSettingsDialog"];
local coordText = settingDialog:CreateFontString(nil, "OVERLAY", "GameFontNormal")
coordText:SetPoint("BOTTOM", settingDialog, "BOTTOM", 0, 125);
local leftArrowButton = CreateFrame("Button", "leftArrorButton", settingDialog, "UIPanelButtonTemplate")
leftArrowButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up")
leftArrowButton:SetPoint("BOTTOM", settingDialog, "BOTTOM", -40, 50);
leftArrowButton:SetSize(30, 30)
local rightArrowButton = CreateFrame("Button", "rightArrorButton", settingDialog, "UIPanelButtonTemplate")
rightArrowButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
rightArrowButton:SetPoint("BOTTOM", settingDialog, "BOTTOM", 40, 50);
rightArrowButton:SetSize(30, 30)
local upArrowButton = CreateFrame("Button", "upArrorButton", settingDialog, "UIPanelButtonTemplate")
upArrowButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-PrevPage-Up")
upArrowButton:SetPoint("BOTTOM", settingDialog, "BOTTOM", 0, 80);
upArrowButton:SetSize(30, 30)
upArrowButton:GetNormalTexture():SetRotation(math.rad(-90))
local downArrowButton = CreateFrame("Button", "downArrorButton", settingDialog, "UIPanelButtonTemplate")
downArrowButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up")
downArrowButton:SetPoint("BOTTOM", settingDialog, "BOTTOM", 0, 20);
downArrowButton:SetSize(30, 30)
downArrowButton:GetNormalTexture():SetRotation(math.rad(-90))
updateEventFrame:HookScript("OnUpdate", function()
if settingDialog:IsShown() then
for name, frame in pairs(core.frames) do
local movable = frame:IsMovable();
if movable then
local left = frame:GetLeft();
local bottom = frame:GetBottom();
local leftFormatted = string.format("%.1f", left);
local bottomFormatted = string.format("%.1f", bottom);
coordText:SetText("X: " .. leftFormatted .. " Y: " .. bottomFormatted)
FineTune:SetUpArrowFunctions(frame);
end
end
end
end)
function FineTune:SetUpArrowFunctions(frame)
leftArrowButton:SetScript("OnClick", function() FineTune:Move(frame, "left") end)
rightArrowButton:SetScript("OnClick", function() FineTune:Move(frame, "right") end)
upArrowButton:SetScript("OnClick", function() FineTune:Move(frame, "up") end)
downArrowButton:SetScript("OnClick", function() FineTune:Move(frame, "down") end)
end
function FineTune:Move(frame, direction)
local editModeTargetFrame = _G["EditModeManagerFrame"]
if editModeTargetFrame then
editModeTargetFrame:SetHasActiveChanges(true)
end
if frame then
local currentPoints = { frame:GetPoint() }
local movingPx = 1;
if IsControlKeyDown() then
movingPx = 0.1;
else
if IsShiftKeyDown() then
movingPx = 10;
end
end
if direction == "left" then
frame:SetPoint(currentPoints[1], currentPoints[2], currentPoints[3], currentPoints[4] - movingPx,
currentPoints[5])
elseif direction == "right" then
frame:SetPoint(currentPoints[1], currentPoints[2], currentPoints[3], currentPoints[4] + movingPx,
currentPoints[5])
elseif direction == "up" then
frame:SetPoint(currentPoints[1], currentPoints[2], currentPoints[3], currentPoints[4],
currentPoints[5] + movingPx)
elseif direction == "down" then
frame:SetPoint(currentPoints[1], currentPoints[2], currentPoints[3], currentPoints[4],
currentPoints[5] - movingPx)
end
frame:OnDragStop()
end
end
function FineTune:Toggle(value)
if value then
coordText:Show()
leftArrowButton:Show()
rightArrowButton:Show()
upArrowButton:Show()
downArrowButton:Show()
else
coordText:Hide()
leftArrowButton:Hide()
rightArrowButton:Hide()
upArrowButton:Hide()
downArrowButton:Hide()
end
end
function FineTune:Initialize()
FineTune:Toggle(EHUD.db.profile.fineTuneHUD.enable)
end