Created
May 24, 2012 05:17
-
-
Save nixpulvis/2779607 to your computer and use it in GitHub Desktop.
repositioning from child
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mover:SetScript("OnDragStart", function() | |
local lastX, lastY = GetCursorPosition() | |
mover:SetScript("OnUpdate", function() | |
local x, y = GetCursorPosition() | |
xOff, yOff = x-lastX, y-lastY | |
lastX, lastY = x, y | |
for i = 1, frame:GetNumPoints() do | |
local point, relativeTo, relativePoint, xOffset, yOffset = frame:GetPoint(i) | |
frame:SetPoint(point, relativeTo, relativePoint, xOffset+xOff, yOffset+yOff) | |
end | |
end) | |
end) | |
mover:SetScript("OnDragStop", function() | |
local xOff, yOff = GetCursorPosition() | |
mover:SetScript("OnUpdate", nil) | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment