Fix Minimap Clean script detection on Atlas frames
This commit is contained in:
@@ -9,7 +9,7 @@ local module = ShaguTweaks:register({
|
|||||||
enabled = false,
|
enabled = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
-- 🛡️ Liste noire : tout ce qu'on ne veut PAS toucher (trackers, blips, boutons systeme...)
|
-- Liste noire : tout ce qu'on ne veut PAS toucher (trackers, blips, boutons systeme...)
|
||||||
local ignoreList = {
|
local ignoreList = {
|
||||||
"MiniMapTrackingFrame",
|
"MiniMapTrackingFrame",
|
||||||
"MiniMapMeetingStoneFrame",
|
"MiniMapMeetingStoneFrame",
|
||||||
@@ -48,10 +48,15 @@ local function ShouldIgnore(name)
|
|||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Vanilla 1.12 can throw an error when GetScript() is queried with a script
|
||||||
|
-- type that the frame object doesn't support (AtlasCFMButtonFrame is one
|
||||||
|
-- example). pcall keeps detection harmless for every frame type.
|
||||||
local function GetScriptSafe(frame, script)
|
local function GetScriptSafe(frame, script)
|
||||||
if frame and frame.GetScript then
|
if not frame or type(frame.GetScript) ~= "function" then return nil end
|
||||||
return frame:GetScript(script)
|
|
||||||
end
|
local ok, handler = pcall(frame.GetScript, frame, script)
|
||||||
|
if ok then return handler end
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local function IsAddonButton(child)
|
local function IsAddonButton(child)
|
||||||
@@ -60,8 +65,6 @@ local function IsAddonButton(child)
|
|||||||
local name = child:GetName()
|
local name = child:GetName()
|
||||||
if ShouldIgnore(name) then return false end
|
if ShouldIgnore(name) then return false end
|
||||||
|
|
||||||
-- HasScript isn't part of the stock 1.12 frame API and can disappear
|
|
||||||
-- depending on the DLL stack. GetScript is enough and avoids that hidden dependency.
|
|
||||||
local hasClick = GetScriptSafe(child, "OnClick")
|
local hasClick = GetScriptSafe(child, "OnClick")
|
||||||
local hasMouseUp = GetScriptSafe(child, "OnMouseUp")
|
local hasMouseUp = GetScriptSafe(child, "OnMouseUp")
|
||||||
local hasMouseDown = GetScriptSafe(child, "OnMouseDown")
|
local hasMouseDown = GetScriptSafe(child, "OnMouseDown")
|
||||||
|
|||||||
Reference in New Issue
Block a user