Has anyone noticed if there have been any recent changes in the API that would explain why this no longer hides the frame ? Thanks in advance for any clues that can shed a light on this.
Scott set up nUI to automatically hide the minimap if a focus was visible. I used to use it a lot in my raiding days so I know it used to work. But I have just had a report that it doesn't work and I can see it not working, but this code is still active and a debug code in this ifelse block shows it gets executed. I haven't touched anything with the focus frame but I have made some changes to the minimap 2 years ago with no complaints then and I can't see anything that would affect the showing/hiding of a frame.
Lua Code:
local frame = CreateFrame( "Frame", "nUI_MinimapManager", nUI_Dashboard.Anchor, "SecureHandlerStateTemplate" );
..... other event code to handle ADDON_LOADED unchanged since at least BFA release ...
elseif event == "PLAYER_ENTERING_WORLD" then
-- create the show/hide logic for the minimap frame... if we have a focus frame, then we hide the minimap
-- frame, otherwise, the minimap frame is visible
frame:SetAttribute( "unit", "focus" );
frame:SetAttribute( "_onstate-unitexists",
[[
if UnitExists( "focus" )
then self:Hide();
else self:Show();
end
]]
);
-- we only need to do this once
frame:UnregisterEvent( "PLAYER_ENTERING_WORLD" );
The frame has been registered as a unit watch frame as follows, which is executed sometime after addon loaded event, which again, hasn't been touched by me in anyway, at least since BFA release:
Lua Code:
frame.applySkin = function( skin )
local skin = skin and skin.Minimap or nUI_DefaultConfig.Minimap;
if skin and skin.enabled then
frame.applyOptions( skin.options );
frame.applyAnchor( skin.anchor );
RegisterUnitWatch( frame, true );
else
UnregisterUnitWatch( frame );
frame:SetScript( "OnUpdate", nil );
frame:SetAlpha( 0 );
end
end