Thread Tools Display Modes
03-05-20, 12:31 PM   #1
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
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
__________________

Last edited by Xrystal : 03-05-20 at 12:49 PM.
  Reply With Quote
03-05-20, 01:13 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
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?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
03-05-20, 02:39 PM   #3
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Originally Posted by Seerah View Post
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.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » focus frame display override not working properly

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off