View Single Post
04-12-13, 07:40 AM   #11
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Well...you can make inline frame dragable aswell. You listen to DragStop.

Once that fires you calculate the point diffenrence of the parent element to your current frame.

I used this function somewhere. I can be changed to deliver the offset you need for your stuff. But actually I do resize/reloading. You only need a couple of tries to get stuff right and don't need to do it again.
Lua Code:
  1. local calcPoint = function(s)
  2.     if s:GetParent():GetName() ~= "UIParent" then
  3.       local Hx, Hy = s:GetParent():GetCenter()
  4.       local W, H = s:GetParent():GetSize()
  5.       local Ox, Oy = s:GetCenter()
  6.       if(not Ox) then return end
  7.       local scale = s:GetScale()
  8.       Hx, Hy = floor(Hx), floor(Hy)
  9.       Ox, Oy = floor(Ox*scale), floor(Oy*scale)
  10.       local Tx, Ty = (Hx-Ox)*(-1), (Hy-Oy)*(-1)
  11.       s:ClearAllPoints()
  12.       s:SetPoint("CENTER",s:GetParent(),Tx/scale,Ty/scale)
  13.     end
  14.   end
__________________
| 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 : 04-12-13 at 07:43 AM.
  Reply With Quote