From 04488dadf21d5a13ac6c314473a350ea4c05f7cf Mon Sep 17 00:00:00 2001 From: Salikh Gurgenidze Date: Tue, 23 Dec 2025 04:26:58 +0400 Subject: [PATCH] fix: drag QuestItem and TrackItem bars --- Guda.toc | 2 +- UI/QuestItemBar.lua | 50 ++++++++++++++++++++++++++++--------------- UI/TrackedItemBar.lua | 46 ++++++++++++++++++++++++--------------- 3 files changed, 63 insertions(+), 35 deletions(-) diff --git a/Guda.toc b/Guda.toc index 513b501..c892fef 100644 --- a/Guda.toc +++ b/Guda.toc @@ -2,7 +2,7 @@ ## Title: Guda ## Notes: All-in-one bag and bank addon for Turtle WoW ## Author: Vati -## Version: 1.3.0 +## Version: 1.3.1 ## SavedVariables: Guda_DB ## SavedVariablesPerCharacter: Guda_CharDB diff --git a/UI/QuestItemBar.lua b/UI/QuestItemBar.lua index d154d55..6b5b4c6 100644 --- a/UI/QuestItemBar.lua +++ b/UI/QuestItemBar.lua @@ -226,19 +226,25 @@ function QuestItemBar:Update() -- Set up the button once button:RegisterForDrag("LeftButton") - button:SetScript("OnDragStart", function() - if IsShiftKeyDown() then - this:GetParent():StartMoving() - this:GetParent().isMoving = true + button:SetScript("OnDragStart", function() end) + button:SetScript("OnReceiveDrag", function() end) + button:SetScript("OnMouseDown", function() + if arg1 == "LeftButton" then + if IsShiftKeyDown() then + this:GetParent():StartMoving() + this:GetParent().isMoving = true + end end end) - button:SetScript("OnDragStop", function() - local parent = this:GetParent() - if parent.isMoving then - parent:StopMovingOrSizing() - parent.isMoving = false - local point, _, relativePoint, x, y = parent:GetPoint() - addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + button:SetScript("OnMouseUp", function() + if arg1 == "LeftButton" then + local parent = this:GetParent() + if parent.isMoving then + parent:StopMovingOrSizing() + parent.isMoving = false + local point, _, relativePoint, x, y = parent:GetPoint() + addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + end end end) end @@ -534,6 +540,10 @@ function QuestItemBar:UpdateFlyout(parent) btn = CreateFrame("Button", "Guda_QuestItemFlyoutButton" .. i, flyoutFrame, "Guda_ItemButtonTemplate") table.insert(flyoutButtons, btn) + btn:SetScript("OnDragStart", function() end) + btn:SetScript("OnReceiveDrag", function() end) + btn:SetScript("OnMouseDown", function() end) + btn:SetScript("OnEnter", function() Guda_ItemButton_OnEnter(this) if flyoutFrame then flyoutFrame.hideTime = GetTime() + 5 end -- Keep open @@ -637,13 +647,19 @@ function QuestItemBar:Initialize() -- Handle dragging frame:RegisterForDrag("LeftButton") - frame:SetScript("OnDragStart", function() - this:StartMoving() + frame:SetScript("OnMouseDown", function() + if arg1 == "LeftButton" then + this:StartMoving() + this.isMoving = true + end end) - frame:SetScript("OnDragStop", function() - this:StopMovingOrSizing() - local point, _, relativePoint, x, y = this:GetPoint() - addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + frame:SetScript("OnMouseUp", function() + if arg1 == "LeftButton" and this.isMoving then + this:StopMovingOrSizing() + this.isMoving = false + local point, _, relativePoint, x, y = this:GetPoint() + addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + end end) -- Restore position diff --git a/UI/TrackedItemBar.lua b/UI/TrackedItemBar.lua index 5b9ec37..9433a55 100644 --- a/UI/TrackedItemBar.lua +++ b/UI/TrackedItemBar.lua @@ -87,19 +87,25 @@ function TrackedItemBar:Update() table.insert(buttons, button) button:RegisterForDrag("LeftButton") - button:SetScript("OnDragStart", function() - if IsShiftKeyDown() then - this:GetParent():StartMoving() - this:GetParent().isMoving = true + button:SetScript("OnDragStart", function() end) + button:SetScript("OnReceiveDrag", function() end) + button:SetScript("OnMouseDown", function() + if arg1 == "LeftButton" then + if IsShiftKeyDown() then + this:GetParent():StartMoving() + this:GetParent().isMoving = true + end end end) - button:SetScript("OnDragStop", function() - local parent = this:GetParent() - if parent.isMoving then - parent:StopMovingOrSizing() - parent.isMoving = false - local point, _, relativePoint, x, y = parent:GetPoint() - addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + button:SetScript("OnMouseUp", function() + if arg1 == "LeftButton" then + local parent = this:GetParent() + if parent.isMoving then + parent:StopMovingOrSizing() + parent.isMoving = false + local point, _, relativePoint, x, y = parent:GetPoint() + addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + end end end) end @@ -173,13 +179,19 @@ function TrackedItemBar:Initialize() -- Handle dragging frame:RegisterForDrag("LeftButton") - frame:SetScript("OnDragStart", function() - this:StartMoving() + frame:SetScript("OnMouseDown", function() + if arg1 == "LeftButton" then + this:StartMoving() + this.isMoving = true + end end) - frame:SetScript("OnDragStop", function() - this:StopMovingOrSizing() - local point, _, relativePoint, x, y = this:GetPoint() - addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + frame:SetScript("OnMouseUp", function() + if arg1 == "LeftButton" and this.isMoving then + this:StopMovingOrSizing() + this.isMoving = false + local point, _, relativePoint, x, y = this:GetPoint() + addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y}) + end end) -- Restore position