unlock: reset frame position on middle click

This commit is contained in:
shagu
2018-05-16 20:38:40 +02:00
parent bd7d2b61fa
commit 4a3caa02ad
2 changed files with 26 additions and 2 deletions
+16 -1
View File
@@ -479,6 +479,14 @@ function pfUI.api.UpdateMovable(frame)
table.insert(pfUI.movables, name)
end
if not frame.posdata then
frame.posdata = { scale = frame:GetScale(), pos = {} }
for i=1,frame:GetNumPoints() do
frame.posdata.pos[i] = { frame:GetPoint(i) }
end
end
if pfUI_config["position"][frame:GetName()] then
if pfUI_config["position"][frame:GetName()]["scale"] then
frame:SetScale(pfUI_config["position"][frame:GetName()].scale)
@@ -488,6 +496,13 @@ function pfUI.api.UpdateMovable(frame)
frame:ClearAllPoints()
frame:SetPoint("TOPLEFT", pfUI_config["position"][frame:GetName()].xpos, pfUI_config["position"][frame:GetName()].ypos)
end
elseif frame.posdata and frame.posdata.pos[1] then
frame:ClearAllPoints()
frame:SetScale(frame.posdata.scale)
for id, point in pairs(frame.posdata.pos) do
frame:SetPoint(unpack(point))
end
end
end
@@ -862,4 +877,4 @@ function pfUI.api.GetColorGradient(perc, ...)
end
return pfUI.api.GetColorGradient(perc,unpack(color_tuples))
end
end
end