Aura Tooltip makes GameTooltip "leave the screen"
LybrialsGit opened this issue ยท 16 comments
Describe the bug
After you hover over a oUF nameplate aura, the GameTooltip will no longer clamp to screen.
It will make the GameTooltip "leave the screen" and so cut off information.
How to reproduce
- Tooltips are not leaving screen:
- I hover an aura on a nameplate to check the aura tooltip
- Tooltips are now leaving screen:
What did you expect?
I would expect that the GameTooltip keeps to clamp to the screen.
Error report
No Error Report
Hello, I'm kinda late to the party I reckon, but I also have this issue with the off-screen Nameplate Tooltips.
Problem is, I have 0 coding knowledge to know what to do with the provided solution. This is the only place on the internet where this issue is addressed so I figured I'd give it a try.
Can I also implement this fix in my game files? Is the Nameplate Addon I'm using relevant?
For a quick explanation on where and how I can implement the code (If it is that simple), I would be very grateful. Thank you!
Hi,
I found out that this only happens if I set the tooltipAnchor
in the auras config manually.
If I do not set this option the error does not occur.
For example If I do:
auras.tooltipAnchor = 'ANCHOR_BOTTOMRIGHT'
which is the default If I read that correctly, the error occurs as I reported it.
But If I do not set this configuration everything works fine.
@Rainrider, it's definitely related to notoriously not-so-great Blizz tooltip code, it's working fine previously, but I guess they changed something with SL. I'll test it with "ANCHOR_CURSOR_RIGHT"
as an alternative, since that's what Blizz use in their UI code now. Alternatively, we could replace GameTooltip
with our own tooltip and use it in all elements.
-- edit
Actually, even "ANCHOR_CURSOR"
works just fine when used on normal unit frame auras, but I need to test it with nameplates. Something fishy is going on.
-- edit
Actually, it works fine even with nameplate auras. Just downloaded the latest elvui to test it out, edited their code to enable tooltips on buffs and debuffs, and nothing broke O_o
@LybrialsGit, which nameplate addon do you use? Did you write it yourself? Can you upload it somewhere? Something weird is going on.
Ayyyy, now I know what's going on :D
Your UNITS:Auras_Update(...)
is called after we enable element on our end. So it overrides our settings, for instance, aforementioned workaround for forbidden/restricted tooltips. That's why you're getting tooltipAnchor
set to ANCHOR_BOTTOMRIGHT
instead of ANCHOR_CURSOR
. I guess I'll have to make our workaround a bit more dynamic.
As for your own code, @LybrialsGit.
There's no elements like Buffs
and Debuffs
both are a part of the Auras
element which consists of three optional widgets: Buffs
, Debuffs
, and Auras
, so you're frame:*Element*("Buffs")
calls did nothing. Also, simply hiding individual widgets of an element won't stop them from updating, to truly stop its updates you'll have to do something like this
frame.Debuffs_ = frame.Debuffs
frame.Debuffs = nil
So for instance, your Debuffs_Update should look like this
function UNITS:Debuffs_Update(frame)
local db = frame.db;
if (db and db.auras and db.auras.debuffs) then
if (db.auras.debuffs.enabled and frame.Debuffs_) then
frame.Debuffs = frame.Debuffs_;
frame.Debuffs_ = nil;
frame.Debuffs:Show();
elseif (not db.auras.debuffs.enabled and frame.Debuffs) then
frame.Debuffs_ = frame.Debuffs;
frame.Debuffs = nil;
frame.Debuffs_:Hide();
end
if (db.auras.debuffs.enabled) then
self:Auras_Update(frame, frame.Debuffs, db.auras.debuffs);
end
if ((db.auras.debuffs.enabled or (not db.auras.buffs or db.auras.buffs.enabled)) and not frame:IsElementEnabled("Auras")) then
-- enable if either buffs or debuffs are enabled
frame:EnableElement("Auras");
elseif (not (db.auras.debuffs.enabled and (not db.auras.buffs or db.auras.buffs.enabled)) and frame:IsElementEnabled("Auras")) then
-- disable only if both buffs or debuffs are disable
frame:DisableElement("Auras");
end
end
end
I reorganised stuff, so it flows better.
ok, thx. that clarifies a lot.
But with that code changes setting auras.tooltipAnchor = 'ANCHOR_BOTTOMRIGHT'
will still casue the issue, right?
At least it did when I tried it a couple of minutes ago.
Nah, I just fixed your code's flow and logic, had to rewrite it while testing. it doesn't fix the issue we're currently investigating ๐ข
But I've just PRed the fix. It works fine now, but feel free to test it on your own.
@p3lim, I already tried that locally since I use TSM all the time, I also installed Pawn for testing since I noticed it in his screenshots. Everything is working fine, at least here. Weird.
I tested it with my nameplate addon and my core addon being the only active addons and the following code for auras:
-- ------------------------------------------------------------------------
-- > Lybrial UI (Lybrial @ Blackhand EU) <
-- ------------------------------------------------------------------------
--
-- Units Auras
--
-- ------------------------------------------------------------------------
local LybrialUI = LybrialUI;
local CORE = LybrialUI:GetCore();
local AURAS = CORE.AURAS;
local COMMON = CORE.COMMON;
local FRAMES = CORE.FRAMES;
local MATH = CORE.MATH;
local UNITS = CORE.UNITS;
local TABLES = CORE.TABLES;
-- ------------------------------------------------------------------------
-- External Upvalues
-- ------------------------------------------------------------------------
-- Lua Functions
-- WOW API
-- ------------------------------------------------------------------------
-- Units Auras Functions
-- ------------------------------------------------------------------------
-- ------------------------------------------------------------------------
-- Buffs
-- ------------------------------------------------------------------------
function UNITS:Buffs_Create(frame)
local buffs = FRAMES:CreateFrame("Frame", frame:GetDebugName() .. "_Buffs", frame);
buffs:SetFrameStrata(frame:GetFrameStrata());
buffs:SetFrameLevel(frame:GetFrameLevel() + 5);
buffs.type = "buffs";
buffs.PostUpdate = self.Auras_PostUpdate;
buffs.PostCreateIcon = self.Auras_PostCreateIcon;
buffs.PostUpdateIcon = self.Auras_PostUpdateIcon;
buffs._SetPosition = self.Auras_SetPosition;
buffs.CustomFilter = AURAS.Filter;
return buffs;
end
function UNITS:Buffs_Update(frame)
local db = frame.db;
if (db and db.auras and db.auras.buffs and db.auras.buffs.enabled) then
if (not frame:IsElementEnabled("Buffs")) then
frame:EnableElement("Buffs");
end
self:Auras_Update(frame, frame.Buffs, db.auras.buffs);
frame.Buffs:Show();
else
if (frame:IsElementEnabled("Buffs")) then
frame:DisableElement("Buffs");
end
frame.Buffs:Hide();
end
end
-- ------------------------------------------------------------------------
-- Debuffs
-- ------------------------------------------------------------------------
function UNITS:Debuffs_Create(frame)
local debuffs = FRAMES:CreateFrame("Frame", frame:GetDebugName() .. "_Debuffs", frame);
debuffs:SetFrameStrata(frame:GetFrameStrata());
debuffs:SetFrameLevel(frame:GetFrameLevel() + 5);
debuffs.type = "debuffs";
debuffs.PostUpdate = self.Auras_PostUpdate;
debuffs.PostCreateIcon = self.Auras_PostCreateIcon;
debuffs.PostUpdateIcon = self.Auras_PostUpdateIcon;
debuffs._SetPosition = self.Auras_SetPosition;
debuffs.CustomFilter = AURAS.Filter;
return debuffs;
end
function UNITS:Debuffs_Update(frame)
local db = frame.db;
if (db and db.auras and db.auras.debuffs and db.auras.debuffs.enabled) then
if (not frame:IsElementEnabled("Debuffs")) then
frame:EnableElement("Debuffs");
end
self:Auras_Update(frame, frame.Debuffs, db.auras.debuffs);
frame.Debuffs:Show();
else
if (frame:IsElementEnabled("Debuffs")) then
frame:DisableElement("Debuffs");
end
frame.Debuffs:Hide();
end
end
-- ------------------------------------------------------------------------
-- General Update
-- ------------------------------------------------------------------------
function UNITS:Auras_Update(frame, auras, db)
auras.disableMouse = db.general.disableMouse;
auras.disableCooldown = db.general.disableCooldown;
auras.onlyShowPlayer = db.general.onlyShowPlayer;
auras.num = db.layout.num;
auras.size = db.layout.size;
auras.spacing = db.layout.spacing;
auras.spacingX = db.layout.spacingX;
auras.spacingY = db.layout.spacingY;
auras.initialAnchor = db.anchors.initialAnchor;
auras.growthX = db.anchors.growthX;
auras.growthY = db.anchors.growthY;
auras.tooltipAnchor = db.anchors.tooltipAnchor;
auras:SetPositionFromDb(db.position, frame);
auras:SetSizeFromDb(db.size);
end
function UNITS:Auras_PostUpdate()
self:_SetPosition(1, TABLES:Size(self));
end
-- ------------------------------------------------------------------------
-- General Icon
-- ------------------------------------------------------------------------
function UNITS:Auras_PostCreateIcon(button)
button:CreateTemplateBackdrop();
button.icon:SetTexCoord(0.1, 0.9, 0.1, 0.9);
button.icon:SetAllPoints();
button.cd:SetInside(button);
button.text = {};
button.text.cd = button:CreateFontString(nil, "OVERLAY", "NumberFontNormal");
button.text.cd:SetScaledPoint("CENTER", button, "CENTER", 0, 0);
local element = button:GetParent();
local nameplate = (element and element.__owner);
local db = (nameplate and nameplate.db);
button.db = (db and db.auras and db.auras[element.type]);
end
function UNITS:Auras_PostUpdateIcon(unit, button, _, _, _, expiration)
local db = self.__owner.db;
if (button.isDebuff and db and db.auras and db.auras.debuffs and db.auras.debuffs.enabled) then
UNITS:Auras_PostUpdateButton(button, db.auras.debuffs, expiration);
elseif ((not button.isDebuff) and db and db.auras and db.auras.buffs and db.auras.debuffs.enabled) then
UNITS:Auras_PostUpdateButton(button, db.auras.buffs, expiration);
end
end
-- ------------------------------------------------------------------------
-- General Button
-- ------------------------------------------------------------------------
function UNITS:Auras_PostUpdateButton(button, db, expiration)
button:SetTemplateBackdropFromDb(Backdrop:GetBackdrop(db.backdrop));
if (db.count.text.enabled) then
button.count:SetPositionFromDb(db.count.text.position, button.count:GetParent());
button.count:SetFontTemplateFromDb(Font:GetFont(db.count.text.font));
button.count:Show();
else
button.count:Hide();
end
if (db.duration.text.enabled) then
button.text.cd:SetPositionFromDb(db.duration.text.position, button);
button.text.cd:SetFontTemplateFromDb(Font:GetFont(db.duration.text.font));
button.text.cd:GetParent():SetScript("OnUpdate", COMMON.UpdateCdAndStacks);
button.text.cd:Show();
else
button.text.cd:GetParent():SetScript("OnUpdate", nil);
button.text.cd:Hide();
end
end
-- ------------------------------------------------------------------------
-- General Position
-- ------------------------------------------------------------------------
function UNITS:Auras_SetPosition(from, to)
local sizeX = (self.size or 16) + (self.spacingX or self.spacing or 0);
local sizeY = (self.size or 16) + (self.spacingY or self.spacing or 0);
local columns = MATH:Floor(self:GetWidth() / sizeX + 0.5);
local anchor = self.initialAnchor or "BOTTOMLEFT";
local growthX = self.growthX;
local growthXDirection = ((self.growthX == "LEFT") and -1) or 1;
local growthYDirection = ((self.growthY == "DOWN") and -1) or 1;
local buttons = {};
for i = from, to do
local button = self[i];
if (button and button:IsVisible()) then
TABLES:Add(buttons, button);
end
end
local buttonsCount = (TABLES:Size(buttons) - 1);
local buttonsCountMax = ((buttonsCount >= columns) and (columns - 1)) or buttonsCount;
local offsetX = -((buttonsCountMax * sizeX) / 2);
for i = 1, TABLES:Size(buttons) do
local button = self[i];
local column = (i - 1) % columns;
local row = MATH:Floor((i - 1) / columns);
button:ClearAllPoints();
if ((growthX == "LEFT") or (growthX == "RIGHT")) then
button:SetScaledPoint(anchor, self, anchor, column * sizeX * growthXDirection, row * sizeY * growthYDirection);
else
local x = offsetX + (column * sizeX);
button:SetScaledPoint(anchor, self, anchor, x, row * sizeY * growthYDirection);
end
end
end
With that I get the tooltip error. The example showing the character equipment tooltip was just for demonstration. Every single tooltip is not clamping to screen after I hovered a nameplate aura once.
As soon as I deleted auras.tooltipAnchor = db.anchors.tooltipAnchor;
(line 126), which was set in my database to be ANCHOR_BOTTOMRIGHT
, the error did no longer occur.
@LybrialsGit, https://www.wowinterface.com/downloads/info24889-LybrialUIv2.html is that it? Or do you have a newer version locally? Could you zip it and post it here?
@ls- I invited you to my core and nameplate github project so you should be able to checkout the repos.
@LybrialsGit eh? Where? Nope, nothing happened.
Strange. I invited you as a contributor.
Whatever, I made the repos public:
@LybrialsGit I'll check it out after I'm done with my dailies :D
Yep. If you take the code as it is now there wont be an error with the nameplate auras and tooltips.
If you put in the auras.tooltipAnchor = db.anchors.tooltipAnchor;
(Lybrial_UI/units/elements/auras.lua line 126)
the error should occur.
db.anchors.tooltipAnchor
will be nil
here because I removed it from the db after
I removed the auras.tooltipAnchor
config.
But in your oUF auras code you check for nil so that should not be a problem:
buffs.tooltipAnchor = buffs.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT'
...
debuffs.tooltipAnchor = debuffs.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT'
...
auras.tooltipAnchor = auras.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT'
You can also directly set it to auras.tooltipAnchor = 'ANCHOR_BOTTOMRIGHT'
.
I tested with both and in both cases the error was reproducable.