View Single Post
06-13-19, 06:58 AM   #2
LudiusMaximus
A Rage Talon Dragon Guard
 
LudiusMaximus's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 322
I still don't know the answers to my first two questions, but I figured out a way to emulate the window repositioning I was referring to in the third question. If anyone is interested in this, add the following code to the end of MoveAnything.lua:

Code:
-- Function to check if the CharacterFrame should push away another frame.
function MovAny.characterFrameCheck(f, ...)
  
  -- Check which frame is open to replace the CharacterFrame, if any.
  local frameToMove = nil

  -- Only one of the following frames can be visible at a time!
  if (MerchantFrame:IsVisible()) then
    frameToMove = MerchantFrame
  elseif (MailFrame:IsVisible()) then
    frameToMove = MailFrame
  end
  
  if (not frameToMove) then
    return
  end

  local opt = MovAny:GetUserData(frameToMove:GetName())

  -- Check if CharacterFrame is visible.
  if (CharacterFrame:IsVisible()) then
    opt.pos = {"TOPLEFT", "CharacterFrame", "TOPRIGHT", 20, 0}
  else
    opt.pos = {"TOPLEFT", "CharacterFrame", "TOPLEFT", 0, 0}
  end
  
  MovAny.Position:Apply(opt, frameToMove)
  
end

hooksecurefunc(CharacterFrame, "Show", MovAny.characterFrameCheck)
hooksecurefunc(CharacterFrame, "Hide", MovAny.characterFrameCheck)

hooksecurefunc(MerchantFrame, "Show", MovAny.characterFrameCheck)
hooksecurefunc(MailFrame, "Show", MovAny.characterFrameCheck)

Last edited by LudiusMaximus : 06-14-19 at 03:12 AM.
  Reply With Quote