mirror of
https://github.com/brues-code/pfUI.git
synced 2026-11-03 09:26:57 +00:00
Make the inspect window movable by dropping EnableMovable's addon wait
This commit is contained in:
+12
-37
@@ -669,48 +669,23 @@ end
|
|||||||
-- [ Enable Movable ]
|
-- [ Enable Movable ]
|
||||||
-- Set all necessary functions to make a already existing frame movable.
|
-- Set all necessary functions to make a already existing frame movable.
|
||||||
-- 'name' [frame/string] Name of the Frame that should be movable
|
-- 'name' [frame/string] Name of the Frame that should be movable
|
||||||
-- 'addon' [string] Addon that must be loaded before being able to access the frame
|
|
||||||
-- 'blacklist' [table] A list of frames that should be deactivated for mouse usage
|
-- 'blacklist' [table] A list of frames that should be deactivated for mouse usage
|
||||||
local function OnDragStart() this:StartMoving() end
|
local function OnDragStart() this:StartMoving() end
|
||||||
local function OnDragStop() this:StopMovingOrSizing() end
|
local function OnDragStop() this:StopMovingOrSizing() end
|
||||||
function pfUI.api.EnableMovable(name, addon, blacklist)
|
function pfUI.api.EnableMovable(name, blacklist)
|
||||||
if addon then
|
if blacklist then
|
||||||
local scan = CreateFrame("Frame")
|
for _, disable in pairs(blacklist) do
|
||||||
scan:RegisterEvent("ADDON_LOADED")
|
_G[disable]:EnableMouse(false)
|
||||||
scan:SetScript("OnEvent", function()
|
|
||||||
if arg1 == addon then
|
|
||||||
local frame = _G[name]
|
|
||||||
|
|
||||||
if blacklist then
|
|
||||||
for _, disable in pairs(blacklist) do
|
|
||||||
_G[disable]:EnableMouse(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
frame:SetMovable(true)
|
|
||||||
frame:EnableMouse(true)
|
|
||||||
frame:RegisterForDrag("LeftButton")
|
|
||||||
frame:SetScript("OnDragStart", OnDragStart)
|
|
||||||
frame:SetScript("OnDragStop", OnDragStop)
|
|
||||||
|
|
||||||
this:UnregisterAllEvents()
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
else
|
|
||||||
if blacklist then
|
|
||||||
for _, disable in pairs(blacklist) do
|
|
||||||
_G[disable]:EnableMouse(false)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local frame = name
|
|
||||||
if type(name) == "string" then frame = _G[name] end
|
|
||||||
frame:SetMovable(true)
|
|
||||||
frame:EnableMouse(true)
|
|
||||||
frame:RegisterForDrag("LeftButton")
|
|
||||||
frame:SetScript("OnDragStart", OnDragStart)
|
|
||||||
frame:SetScript("OnDragStop", OnDragStop)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local frame = name
|
||||||
|
if type(name) == "string" then frame = _G[name] end
|
||||||
|
frame:SetMovable(true)
|
||||||
|
frame:EnableMouse(true)
|
||||||
|
frame:RegisterForDrag("LeftButton")
|
||||||
|
frame:SetScript("OnDragStart", OnDragStart)
|
||||||
|
frame:SetScript("OnDragStop", OnDragStop)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- [ Copy Table ]
|
-- [ Copy Table ]
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ pfUI:RegisterSkin("Character", function ()
|
|||||||
CharacterFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
|
CharacterFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
|
||||||
CharacterFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72)
|
CharacterFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72)
|
||||||
CharacterFrame:SetHitRectInsets(10,30,10,72)
|
CharacterFrame:SetHitRectInsets(10,30,10,72)
|
||||||
EnableMovable("CharacterFrame", nil, CHARACTERFRAME_SUBFRAMES)
|
EnableMovable("CharacterFrame", CHARACTERFRAME_SUBFRAMES)
|
||||||
|
|
||||||
SkinCloseButton(CharacterFrameCloseButton, CharacterFrame.backdrop, -6, -6)
|
SkinCloseButton(CharacterFrameCloseButton, CharacterFrame.backdrop, -6, -6)
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ pfUI:RegisterSkin("Inspect", function ()
|
|||||||
InspectFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
|
InspectFrame.backdrop:SetPoint("TOPLEFT", 10, -10)
|
||||||
InspectFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72)
|
InspectFrame.backdrop:SetPoint("BOTTOMRIGHT", -30, 72)
|
||||||
InspectFrame:SetHitRectInsets(10,30,10,72)
|
InspectFrame:SetHitRectInsets(10,30,10,72)
|
||||||
EnableMovable("InspectFrame", "Blizzard_InspectUI", INSPECTFRAME_SUBFRAMES)
|
EnableMovable("InspectFrame", INSPECTFRAME_SUBFRAMES)
|
||||||
|
|
||||||
SkinCloseButton(InspectFrameCloseButton, InspectFrame.backdrop, -6, -6)
|
SkinCloseButton(InspectFrameCloseButton, InspectFrame.backdrop, -6, -6)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user