View Single Post
11-15-11, 07:52 AM   #3
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Stako I had this with rBBS aswell.

lua Code:
  1. --so we want to move a frame that is actually hooked to the dragframe
  2.   --do make this work we need to trick, because drag functionality ignores the parented frame and used UIParent...we don't want that, because the child would not move with the parent anymore
  3.   local calcPoint = function(s)
  4.     if s:GetParent():GetName() ~= "UIParent" then
  5.       local Hx, Hy = s:GetParent():GetCenter()
  6.       local Ox, Oy = s:GetCenter()
  7.       if(not Ox) then return end
  8.       local scale = s:GetScale()
  9.       Hx, Hy = floor(Hx), floor(Hy)
  10.       Ox, Oy = floor(Ox*scale), floor(Oy*scale)
  11.       local Tx, Ty = (Hx-Ox)*(-1), (Hy-Oy)*(-1)
  12.       s:ClearAllPoints()
  13.       s:SetPoint("CENTER",s:GetParent(),Tx/scale,Ty/scale)
  14.     end
  15.   end

You have to dig into the code I guess...
http://code.google.com/p/rothui/sour...BS/core.lua#74

I have a drag frame container and move frames that are parented to to the drag frame container in relative position to the center of the drag frame container.

calcPoint is called OnDragStop and on PLAYER_LOGIN event (because the position of saved frames in layout-local.txt needs to be rechecked on loadup).
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 11-15-11 at 07:57 AM.
  Reply With Quote