mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-22 15:46:56 +00:00
unlock: reset frame position on middle click
This commit is contained in:
+16
-1
@@ -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
|
||||
|
||||
+10
-1
@@ -74,7 +74,8 @@ pfUI:RegisterModule("unlock", function ()
|
||||
end
|
||||
|
||||
if not frame.drag then
|
||||
frame.drag = CreateFrame("Frame", nil, frame)
|
||||
frame.drag = CreateFrame("Button", nil, frame)
|
||||
frame.drag:RegisterForClicks("MiddleButtonUp")
|
||||
frame.drag:SetAllPoints(frame)
|
||||
frame.drag:SetFrameStrata("DIALOG")
|
||||
CreateBackdrop(frame.drag, nil, nil, .8)
|
||||
@@ -142,6 +143,7 @@ pfUI:RegisterModule("unlock", function ()
|
||||
|
||||
|
||||
frame.drag:SetScript("OnMouseDown",function()
|
||||
if arg1 == "MiddleButton" then return end
|
||||
if IsShiftKeyDown() then
|
||||
if strsub(frame:GetName(),0,7) == "pfCombo" then
|
||||
for i=1,5 do
|
||||
@@ -201,6 +203,7 @@ pfUI:RegisterModule("unlock", function ()
|
||||
end)
|
||||
|
||||
frame.drag:SetScript("OnMouseUp",function()
|
||||
if arg1 == "MiddleButton" then return end
|
||||
frame:StopMovingOrSizing()
|
||||
_, _, _, xpos, ypos = frame:GetPoint()
|
||||
frame.drag.backdrop:SetBackdropBorderColor(.2,1,.8,1)
|
||||
@@ -258,6 +261,11 @@ pfUI:RegisterModule("unlock", function ()
|
||||
pfUI.unlock:SavePosition(frame)
|
||||
pfUI.unlock.settingChanged = true
|
||||
end)
|
||||
|
||||
frame.drag:SetScript("OnClick", function()
|
||||
pfUI_config["position"][frame:GetName()] = nil
|
||||
UpdateMovable(frame)
|
||||
end)
|
||||
end
|
||||
|
||||
frame:SetMovable(true)
|
||||
@@ -280,6 +288,7 @@ pfUI:RegisterModule("unlock", function ()
|
||||
if frame.hideLater == true then
|
||||
frame:Hide()
|
||||
end
|
||||
UpdateMovable(frame)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user