frozn / TipTac

WoW AddOn TipTac Reborn
GNU General Public License v3.0
116 stars 25 forks source link

[WotLK] Fade Time Doesn't Work for World Objects #94

Open stratoru opened 1 year ago

stratoru commented 1 year ago

Fading works correctly for all tooltips except for world objects, where it seems to use the default fade time.

To reproduce: hover over a world object (such as a campfire or brazier) and then move your mouse. It takes 3 seconds to fade out.

The relevant code is likely here: https://github.com/frozn/TipTac/blob/215c4d4706a56948a41b0ec70297d81de2e02168/TipTacOptions/ttOptions.lua#L77 but I could be wrong.

frozn commented 1 year ago

It seems that it's a possible blizzard bug, because the event CURSOR_UPDATE exists in classic, bcc and sl, but not in wotlkc. But registering to this event is needed to handle the world tooltips. With the current workaround I prevent the lua error here;

https://github.com/frozn/TipTac/blob/215c4d4706a56948a41b0ec70297d81de2e02168/TipTac/ttCore.lua#L654-L661

stratoru commented 1 year ago

I believe that it being missing in WotLK is intentional, as it is also being removed in Dragonflight as well.

See: https://wowpedia.fandom.com/wiki/CURSOR_UPDATE

stratoru commented 1 year ago

I believe in classic it is now CURSOR_CHANGED

frozn commented 1 year ago

You're right. I considered this in the new release v22.09.17.

stratoru commented 1 year ago

Hey @frozn, just a heads up, this was never fixed. It has been broken in Classic ever since. I actually found a workaround that fixed all issues with world frames. The issue was that world object tooltips would never hide if you right click the world frame while the tooltip was showing (and hadn't faded out instantly yet).

Upon right click (like when turning your character, or even when double clicking to run), the fade time would reset on the world tooltip back to full duration and not start over again until the right click was released. Super annoying bug.

Anyway, here was the fix I implemented into a custom code snippet (seperate from TipTac, I made just a basic addon solely for this purpose). Feel free to yoink it and edit it to fit your addon however you want!

local f = CreateFrame("Frame")
f:RegisterEvent("PLAYER_LOGIN")
f:SetScript("OnEvent", function(self, event, ...)
    if event == "PLAYER_LOGIN" then
        self:RegisterEvent("GLOBAL_MOUSE_DOWN")
        self:UnregisterEvent("PLAYER_LOGIN")
    elseif event == "GLOBAL_MOUSE_DOWN" then
        local button = ...
        if button == "RightButton" then
            GameTooltip:Hide()
            for _, child in pairs({WorldFrame:GetChildren()}) do
                if child and child.GetObjectType and child:GetObjectType() == "GameTooltip" and not child:IsProtected() and child:IsShown() then
                    child:Hide()
                    child:Show()
                end
            end
        end
    end
end)
frozn commented 1 year ago

Are you shure your modification is needed with the actual version of TipTac? I checked this for myself but the tooltips for world objects (e.g. mailboxes) fades out properly if I right click and move away from them. 🤔

Kolmarwow commented 1 year ago

I've seen this same issue myself but with World Units instead of World Objects. If you hold a mouse button down on a player and take mouse off them then the default 3 sec fade will show up until you let go of the mouse button. Any mouse button replicates this behavior, not just RMB.