home /music /blog

daveconway.net/blog

Improved Tooltip Anchoring in ElvUI

Yeah, This Is, Like, a Thing I Do, I Guess

posted 12 April 2019 in Development, Games

I'm currently working on a long-form article titled, "The Case for Guild Wars 2: Why Your Dumbass Friends Should Play this MMORPG Instead of Other MMORPGs," but, in the meantime, I've been playing World of Warcraft because my friends have shit taste and I hate them and myself.

In any case, I'm using the popular ElvUI complete UI replacement add-on, because WoW's UI looks like a fifteen-year-old UI, and ElvUI is pretty sleek right out of the box.

Despite its head-spinningly massive number of configuration options, it doesn't allow for any granularity in tooltip anchoring. That is to say, if I want tooltips anchored to my cursor location, which I generally do when hovering over hotbar icons, then all tooltips are anchored to my cursor position, despite the fact that I don't want this when hovering over targets and party frames, because it puts ugly tooltips smack dab in the middle of the screen. I want those anchored in the normal tooltip anchor spot (lower-right corner of the screen, by default).

I have crafted a tiny modification to ElvUI that allows me to have the best of both worlds, and I will share it with you today. Really, I'm sharing it with myself, so that when I inevitably have to update ElvUI, I can quickly make this change again.

Step 1: Enable cursor anchoring

This is easy enough:

  1. Open the ElvUI options panel (either directly via the Game Menu or by typing "/ec" in chat).
  2. Click "Tooltip" in the left menu.
  3. Check the "Cursor Anchor" box.

Step 2: Do this code thing

Open the file <Your WoW Path> -> _retail_ -> Interface -> AddOns -> ElvUI -> Modules -> Tooltip -> Tooltip.lua in a text editor, preferably one with line numbers (like Notepad++ or Atom).

On line ~140 of that file, you'll see code that looks like this:

if parent then
    if self.db.cursorAnchor then
        tt:SetOwner(parent, self.db.cursorAnchorType, self.db.cursorAnchorX, self.db.cursorAnchorY)
        return
    else
        tt:SetOwner(parent, "ANCHOR_NONE")
    end
end

Replace that chunk with this, instead:

if parent then
    if self.db.cursorAnchor then
        if (ownerName and (
            strfind(ownerName, "ElvUI_Bar") or
            strfind(ownerName, "ElvUI_StanceBar") or
            strfind(ownerName, "PetAction")
        )) then
            tt:SetOwner(parent, self.db.cursorAnchorType, self.db.cursorAnchorX, self.db.cursorAnchorY)
        else
            tt:SetOwner(parent, "ANCHOR_NONE")
        end

        return
    else
        tt:SetOwner(parent, "ANCHOR_NONE")
    end
end

And that's it. If you're curious about what the change does, it basically says, "hey, if I'm hovering over a hotbar, stance bar (whatever that is), or a pet hotbar, anchor the tooltip to my mouse. Otherwise, just anchor it to the regular spot." This probably doesn't work with non-ElvUI hotbar add-ons, but I imagine those add-ons do their own tooltipping.

Step 3: Reload ElvUI

I don't know if you can even specifically reload add-ons, so I just restarted the whole game. Worked like a charm.

Here are some hot screenshots

Hotbar tooltip.

 

Target tooltip.

Celeste: Dave Played a Game >>
BROWSE BY TAG: Dave Played a Game Development Games Lengthy Reads Life MuseScore Site