WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   focus frame display override not working properly (https://www.wowinterface.com/forums/showthread.php?t=57860)

Xrystal 03-05-20 12:31 PM

focus frame display override not working properly
 
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:
  1. local frame      = CreateFrame( "Frame", "nUI_MinimapManager", nUI_Dashboard.Anchor, "SecureHandlerStateTemplate" );
  2.        ..... other event code to handle ADDON_LOADED unchanged since at least BFA release  ...
  3.     elseif event == "PLAYER_ENTERING_WORLD" then
  4.         -- create the show/hide logic for the minimap frame... if we have a focus frame, then we hide the minimap
  5.         -- frame, otherwise, the minimap frame is visible
  6.         frame:SetAttribute( "unit", "focus" );
  7.         frame:SetAttribute( "_onstate-unitexists",
  8.             [[
  9.                 if UnitExists( "focus" )
  10.                 then self:Hide();
  11.                 else self:Show();
  12.                 end
  13.             ]]
  14.         );
  15.         -- we only need to do this once
  16.         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:
  1. frame.applySkin = function( skin )
  2.     local skin = skin and skin.Minimap or nUI_DefaultConfig.Minimap;
  3.     if skin and skin.enabled then
  4.         frame.applyOptions( skin.options );
  5.         frame.applyAnchor( skin.anchor );
  6.         RegisterUnitWatch( frame, true );
  7.     else
  8.         UnregisterUnitWatch( frame );
  9.         frame:SetScript( "OnUpdate", nil );
  10.         frame:SetAlpha( 0 );
  11.     end
  12. end

Seerah 03-05-20 01:13 PM

You're missing some code here. Where does it actually (attempt to) hide/show the minimap? I only see "self", which I assume is referring to nUI_MinimapManager?

Xrystal 03-05-20 02:39 PM

Quote:

Originally Posted by Seerah (Post 335288)
You're missing some code here. Where does it actually (attempt to) hide/show the minimap? I only see "self", which I assume is referring to nUI_MinimapManager?

Sorry, nUI's code is so convoluted that I was trying to extract the important parts.

The minimap is parented to the MinimapManager. By default the Minimap is visible and what it used to do was hide the minimap and replace it with the focus frame.

I'm trying to create a minimised version of the effect but struggling at the moment.

The ADDON_LOADED event registers callbacks which include applyOptions and applyScale. applyOptions has another set of code that does the show/hide toggle of the minimap frame based on the focus attribute flag being true. Again frame is being used which has always been the manager. Minimap:Hide/Show has never been called directly so can't figure out why it would have changed recently. Unless of course no one has ever used the /focus while using nUI. I know it used to work but the last time I seriously played was back in Cataclysm days. I've rarely set foot into a dungeon or raid since then, but I am sure other's have, which is why I was thinking of a recent change for there to only be a report now, 2 years after the latest expansion with on approx 3,000 users.

Lua Code:
  1. if UnitExists( "focus" )
  2.         then frame:Hide();
  3.         else frame:Show();
  4.     end

Aha .. I think I may have figured it out ..

One of the changes I made at the start of the expansion was to move the Minimap and not the MinimapCluster as per several discussions on the forum due to several error messages that occurred.

Before BFA
Lua Code:
  1. MinimapCluster:EnableMouse( false );
  2.     MinimapCluster:SetParent( frame );
  3.     MinimapCluster:SetFrameStrata( frame:GetFrameStrata() );
  4.     MinimapCluster:SetFrameLevel( frame:GetFrameLevel()+1 );

What I forgot to do was do the equivalent to the Minimap frame. And yes, that resolved the issue.

Thanks for alerting me to that vital part I clearly missed in my earlier perusal rofl.


All times are GMT -6. The time now is 09:46 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI