Quantcast

Fix for frames getting stuck to mouse cursor

James Whitehead II [10-31-09 - 18:30]
Fix for frames getting stuck to mouse cursor
Filename
PerfectRaid.lua
diff --git a/PerfectRaid.lua b/PerfectRaid.lua
index a5cb66a..40442e6 100644
--- a/PerfectRaid.lua
+++ b/PerfectRaid.lua
@@ -188,6 +188,7 @@ local function OnDragStart(frame)
 	if not PerfectRaid.db.profile.locked then
 		parent:StartMoving()
 		PerfectRaid.moving = parent
+        PerfectRaid.movingButton = frame
 	end
 end

@@ -196,6 +197,7 @@ local function OnDragStop(frame)
 	parent:StopMovingOrSizing()
 	PerfectRaid:SavePosition(parent:GetName())
 	PerfectRaid.moving = nil
+    PerfectRaid.movingButton = nil
 end

 function PerfectRaid:CreateRaidFrame(idx)
@@ -448,8 +450,9 @@ local function OnShow(frame)
 end

 local function OnHide(frame)
-	local unit = frame:GetAttribute("unit")
-	frames[unit][frame] = nil
+    if frame == PerfectRaid.movingButton then
+        PerfectRaid.moving:StopMovingOrSizing()
+    end
 end

 function OnAttributeChanged(frame, name, value)
@@ -622,6 +625,7 @@ function PerfectRaid.ConfigureButton(button)
 	button:SetScript("OnDragStart", OnDragStart)
 	button:SetScript("OnDragStop", OnDragStop)
 	button:SetScript("OnAttributeChanged", OnAttributeChanged)
+    button:SetScript("OnHide", OnHide)
 end

 function PerfectRaid:UpdateButtonLayout(button)