WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Using UIFrameFadeIn/Out to hide UIParent no longer hides the map and quest objectives (https://www.wowinterface.com/forums/showthread.php?t=56611)

Krainz 08-28-18 05:41 AM

Using UIFrameFadeIn/Out to hide UIParent no longer hides the map and quest objectives
 
Hi,

You guys helped me in the past with this addon:

Code:

local addonName, addonTable = ... ;

local addon = CreateFrame("Frame");

local GetCursorPosition, IsMouselooking = GetCursorPosition, IsMouselooking
local GetMouseFocus = GetMouseFocus
local UIParent, WorldFrame = UIParent, WorldFrame


function addon:FadeIn()
        if not MovieFrame:IsShown() then
                UIFrameFadeIn(UIParent, addonTable.TIMETOFADEIN, UIParent:GetAlpha(), addonTable.FADEIN);
        end
end;

function addon:FadeOut()
        UIFrameFadeOut(UIParent, addonTable.TIMETOFADEOUT, UIParent:GetAlpha(), addonTable.FADEOUT);
end;

function addon:Fadera()
        UIFrameFadeOut(UIParent, 0.1, UIParent:GetAlpha(), 0.01);
end;


addon.timer = 0
local taxi = 0
addon:SetScript("OnEvent", function(self, event, ...)

                if event == "PLAYER_CONTROL_LOST" and not (UnitAffectingCombat("Player") or InCombatLockdown() or IsInInstance()) then
                        self.taxi = 1
                        addon:Fadera();
                end;
                if event == "PLAYER_CONTROL_GAINED" then
                        self.taxi = 0
                end;
                if event == "CINEMATIC_START" then
                        self.taxi = 1
                        addon:Fadera();
                end;
                if event == "CINEMATIC_STOP" then
                        self.taxi = 0
                end;
                if event == "LFG_UPDATE" then
                        addon:FadeIn();
                        self.timer = 4
                end;
end);

addon:RegisterEvent('PLAYER_CONTROL_LOST')
addon:RegisterEvent('PLAYER_CONTROL_GAINED')
addon:RegisterEvent('CINEMATIC_START')
addon:RegisterEvent('CINEMATIC_STOP')
addon:RegisterEvent('LFG_UPDATE')



addon:SetScript("OnUpdate", function(self, elapsed)
                self.timer = self.timer + elapsed

                local speed = GetUnitSpeed("player");
                local x, y = GetCursorPosition();

                if InCinematic() or (QuestFrame:IsShown() and IsAddOnLoaded("CatchTheWind")) then
                        self.timer = addonTable.TIMEAFK
                        addon:FadeOut();
                elseif
                ((self.taxi ~= 1
                and
                ((self.x ~= x and not (not IsResting() and not IsInInstance()))
                or (self.y ~= y and not (not IsResting() and not IsInInstance()))
                or (UnitAffectingCombat("Player")
                or InCombatLockdown()
                or (speed ~=0 and not (not IsResting() and not IsInInstance()))
                or UnitName("mouseover")
                or WorldMapFrame:IsShown()
                or MailFrame:IsShown()
                or (CollectionsJournal and CollectionsJournal:IsShown())
                or GossipFrame:IsShown()
                or GameTooltipTextLeft1:GetText()
                or UnitCastingInfo("Player")
                or UnitChannelInfo("Player")
                or (UnitExists("Target") and not InCinematic())))
                )
                or ChatFrame1EditBox:IsShown()
                )
                and not (QuestFrame:IsShown() and IsAddOnLoaded("CatchTheWind"))
                then
                        if not InCinematic() then
                                addon:FadeIn();
                        end;
                elseif not IsMouselooking() and self.timer > addonTable.TIMEAFK and (GetMouseFocus() == WorldFrame and not MovieFrame:IsShown())
                then
                        self.timer = 0
                        addon:FadeOut();
                end;
                if self.timer > addonTable.TIMEAFK or InCinematic() then
                        if not IsMouselooking() and (GetMouseFocus() == WorldFrame and not MovieFrame:IsShown())

                        then
                                self.x = x
                                self.y = y

                        end;

                        self.timer = 0
                end;
end)

After one of Legion's patches, it stopped hiding the map and objectives tracker, however. I don't know why. But that's fine.

The issue is, that also happens when the in-game cutscenes (those with the black bars, not the cinematic ones) play and it's kinda annoying to have the quest list + minimap showing up on top of the cutscene.

Is there a way to fix that?

zork 08-28-18 07:29 AM

What is the parent frame of the minimap cluster?

Seerah 08-28-18 02:26 PM

Is this happening with all addons disabled? Because I'm not having an issue with things hiding during cutscenes (at least not with my PocketPlot and WFWW enabled).

Krainz 08-29-18 01:22 AM

Quote:

Originally Posted by zork (Post 329891)
What is the parent frame of the minimap cluster?

I don't know.

Quote:

Originally Posted by Seerah (Post 329901)
Is this happening with all addons disabled? Because I'm not having an issue with things hiding during cutscenes (at least not with my PocketPlot and WFWW enabled).

You are absolutely correct. That doesn't happen with all addons disabled. Is there a way of "protecting" this operation so other addons don't interfere with it?

If it helps, here's my framestack for the minimap and quest objectives:




Seerah 08-29-18 07:45 PM

One (or more) of your addons is changing the parent of these frames. A frame stack doesn't help with that.

zork 08-30-18 12:19 AM

You can try
Lua Code:
  1. /run print(MinimapCluster:GetParent():GetName())
and
Lua Code:
  1. /run print(Minimap:GetParent():GetName())


All times are GMT -6. The time now is 08:10 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI