git
/
wowui.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
290e5ed
)
555cd13 - Add tooltips
author
Aleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 26 Jan 2018 21:43:10 +0000
committer
Aleksi Blinnikka <aleksi.blinnikka@gmail.com>
Fri, 26 Jan 2018 21:43:10 +0000
OmaRF/RaidFrame.lua
patch
|
blob
|
history
diff --git
a/OmaRF/RaidFrame.lua
b/OmaRF/RaidFrame.lua
index
dc5a7a7
..
461d4dc
100644
(file)
--- a/
OmaRF/RaidFrame.lua
+++ b/
OmaRF/RaidFrame.lua
@@
-6,6
+6,8
@@
local UnitHealthMax, UnitPowerMax = UnitHealthMax, UnitPowerMax;
local UnitInRange = UnitInRange;
local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
local STANDARD_TEXT_FONT = STANDARD_TEXT_FONT;
local UnitInRange = UnitInRange;
local CreateFrame, RegisterStateDriver, RegisterUnitWatch = CreateFrame, RegisterStateDriver, RegisterUnitWatch;
local STANDARD_TEXT_FONT = STANDARD_TEXT_FONT;
+local GameTooltip = nil;
+local GameTooltip_SetDefaultAnchor = nil;
local registerEvents = OmaRFEvents.RegisterEvents;
local unitEvent = OmaRFEvents.UnitEvent;
local registerEvents = OmaRFEvents.RegisterEvents;
local unitEvent = OmaRFEvents.UnitEvent;
@@
-104,6
+106,15
@@
local function frameHide(frame)
frame:SetScript("OnUpdate", nil);
end
frame:SetScript("OnUpdate", nil);
end
+local function showTooltip(frame)
+ GameTooltip_SetDefaultAnchor(GameTooltip, PlayerFrame);
+ GameTooltip:SetUnit(frame:GetAttribute("unit"));
+end
+
+local function hideTooltip(frame)
+ GameTooltip:FadeOut();
+end
+
local function setupFrame(frame, secure, unit)
secure:SetAttribute("unit", unit);
frame:SetAttribute("unit", unit);
local function setupFrame(frame, secure, unit)
secure:SetAttribute("unit", unit);
frame:SetAttribute("unit", unit);
@@
-194,6
+205,11
@@
local function setupFrame(frame, secure, unit)
frame:SetScript("OnShow", frameShow);
frame:SetScript("OnHide", frameHide);
frame:SetScript("OnEvent", unitEvent);
frame:SetScript("OnShow", frameShow);
frame:SetScript("OnHide", frameHide);
frame:SetScript("OnEvent", unitEvent);
+ -- let other addons hook these to anchor tooltip elsewhere
+ GameTooltip = _G["GameTooltip"];
+ GameTooltip_SetDefaultAnchor = _G["GameTooltip_SetDefaultAnchor"];
+ secure:SetScript("OnEnter", showTooltip);
+ secure:SetScript("OnLeave", hideTooltip);
-- set attributes
secure:RegisterForClicks("AnyDown");
for attr, val in pairs(attributes) do
-- set attributes
secure:RegisterForClicks("AnyDown");
for attr, val in pairs(attributes) do