From a78a884659771cbef4c7d03b6a3ff4fb703c5f91 Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 23 Oct 2024 17:09:40 +0200 Subject: [PATCH] tracker: add slash command to lock tracker --- slashcmd.lua | 8 ++++++++ tracker.lua | 7 ++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/slashcmd.lua b/slashcmd.lua index 6ce60bc..b3a0895 100644 --- a/slashcmd.lua +++ b/slashcmd.lua @@ -8,6 +8,7 @@ SlashCmdList["PFDB"] = function(input, editbox) if (input == "" or input == nil) then DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpf|cffffffffQuest (v" .. pfQuestConfig.version .. "):") + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc/db|cffffffff lock |cffcccccc - " .. pfQuest_Loc["Lock map tracker"]) DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc/db|cffffffff tracker |cffcccccc - " .. pfQuest_Loc["Show map tracker"]) DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc/db|cffffffff journal |cffcccccc - " .. pfQuest_Loc["Show quest journal"]) DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc/db|cffffffff arrow |cffcccccc - " .. pfQuest_Loc["Show quest arrow"]) @@ -180,6 +181,13 @@ SlashCmdList["PFDB"] = function(input, editbox) return end + -- argument: lock + if (arg1 == "lock") then + pfQuest_config.lock = not pfQuest_config.lock + DEFAULT_CHAT_FRAME:AddMessage("|cff33ffccpf|cffffffffQuest Tracker: " .. ( pfQuest_config.lock and "Locked" or "Unlocked" )) + return + end + -- argument: journal if (arg1 == "journal") then if pfJournal then pfJournal:Show() end diff --git a/tracker.lua b/tracker.lua index 85f1485..0ff1912 100644 --- a/tracker.lua +++ b/tracker.lua @@ -75,7 +75,12 @@ tracker:SetScript("OnEvent", function() end end) -tracker:SetScript("OnMouseDown",function() this:StartMoving() end) +tracker:SetScript("OnMouseDown",function() + if not pfQuest_config.lock then + this:StartMoving() + end +end) + tracker:SetScript("OnMouseUp",function() this:StopMovingOrSizing() local anchor, x, y = pfUI.api.ConvertFrameAnchor(this, pfUI.api.GetBestAnchor(this))