fix: drag QuestItem and TrackItem bars

This commit is contained in:
Salikh Gurgenidze
2025-12-23 04:26:58 +04:00
parent d7e1269d0c
commit 04488dadf2
3 changed files with 63 additions and 35 deletions
+29 -17
View File
@@ -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