Nice one. I'll definitly bookmark this for later use.
Originally Posted by Resike
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:
frame:SetScript("OnDragStop", function(self)
self:StopMovingOrSizing()
self.x = self:GetLeft()
self.y = (self:GetTop() - self:GetHeight())
self:ClearAllPoints()
self:SetPoint("BOTTOMLEFT", self:GetParent(), "BOTTOMLEFT", self.x, self.y)
end)