Skip to content

Instantly share code, notes, and snippets.

@nixpulvis
Created May 24, 2012 05:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nixpulvis/2779607 to your computer and use it in GitHub Desktop.
Save nixpulvis/2779607 to your computer and use it in GitHub Desktop.
repositioning from child
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