Thread: Resize frame
View Single Post
01-25-14, 01:28 PM   #16
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Nice one. I'll definitly bookmark this for later use.

Originally Posted by Resike View Post
But still every time i moved the frame, then tried to resize it, it randomly jumped +/- y axis. Not sure why, probably some other scaling issue, since you can't just get the coords with simply the GetBottom/GetTop.
My guess is that's due to the way the moving stuff works. It re-anchors the frame all the time (to the nearest anchor point or whatever ... I don't know ). If you anchor a frame to center/center and move it to the left then it will be re-anchored to left/left or something.

You can work around this annoying behavior with re-anchoring it to the desired anchor on OnDragStop.

Lua Code:
  1. frame:SetScript("OnDragStop", function(self)
  2.         self:StopMovingOrSizing()
  3.         self.x = self:GetLeft()
  4.         self.y = (self:GetTop() - self:GetHeight())
  5.         self:ClearAllPoints()
  6.         self:SetPoint("BOTTOMLEFT", self:GetParent(), "BOTTOMLEFT", self.x, self.y)
  7.     end)

Last edited by Duugu : 01-25-14 at 01:32 PM.
  Reply With Quote