mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-02 03:39:59 +00:00
api: cache mouse-drag functions
This commit is contained in:
+6
-13
@@ -454,6 +454,8 @@ end
|
||||
-- '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
|
||||
local function MoveMouseDown() this:StartMoving() end
|
||||
local function MoveMouseUp() this:StopMovingOrSizing() end
|
||||
function pfUI.api.EnableMovable(name, addon, blacklist)
|
||||
if addon then
|
||||
local scan = CreateFrame("Frame")
|
||||
@@ -470,13 +472,9 @@ function pfUI.api.EnableMovable(name, addon, blacklist)
|
||||
|
||||
frame:SetMovable(true)
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnMouseDown",function()
|
||||
this:StartMoving()
|
||||
end)
|
||||
frame:SetScript("OnMouseDown", MoveMouseDown)
|
||||
frame:SetScript("OnMouseUp", MoveMouseUp)
|
||||
|
||||
frame:SetScript("OnMouseUp",function()
|
||||
this:StopMovingOrSizing()
|
||||
end)
|
||||
this:UnregisterAllEvents()
|
||||
end
|
||||
end)
|
||||
@@ -491,13 +489,8 @@ function pfUI.api.EnableMovable(name, addon, blacklist)
|
||||
if type(name) == "string" then frame = _G[name] end
|
||||
frame:SetMovable(true)
|
||||
frame:EnableMouse(true)
|
||||
frame:SetScript("OnMouseDown",function()
|
||||
this:StartMoving()
|
||||
end)
|
||||
|
||||
frame:SetScript("OnMouseUp",function()
|
||||
this:StopMovingOrSizing()
|
||||
end)
|
||||
frame:SetScript("OnMouseDown", MoveMouseDown)
|
||||
frame:SetScript("OnMouseUp", MoveMouseUp)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user