fix: drag QuestItem and TrackItem bars
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
## Title: Guda
|
## Title: Guda
|
||||||
## Notes: All-in-one bag and bank addon for Turtle WoW
|
## Notes: All-in-one bag and bank addon for Turtle WoW
|
||||||
## Author: Vati
|
## Author: Vati
|
||||||
## Version: 1.3.0
|
## Version: 1.3.1
|
||||||
## SavedVariables: Guda_DB
|
## SavedVariables: Guda_DB
|
||||||
## SavedVariablesPerCharacter: Guda_CharDB
|
## SavedVariablesPerCharacter: Guda_CharDB
|
||||||
|
|
||||||
|
|||||||
+33
-17
@@ -226,19 +226,25 @@ function QuestItemBar:Update()
|
|||||||
|
|
||||||
-- Set up the button once
|
-- Set up the button once
|
||||||
button:RegisterForDrag("LeftButton")
|
button:RegisterForDrag("LeftButton")
|
||||||
button:SetScript("OnDragStart", function()
|
button:SetScript("OnDragStart", function() end)
|
||||||
if IsShiftKeyDown() then
|
button:SetScript("OnReceiveDrag", function() end)
|
||||||
this:GetParent():StartMoving()
|
button:SetScript("OnMouseDown", function()
|
||||||
this:GetParent().isMoving = true
|
if arg1 == "LeftButton" then
|
||||||
|
if IsShiftKeyDown() then
|
||||||
|
this:GetParent():StartMoving()
|
||||||
|
this:GetParent().isMoving = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
button:SetScript("OnDragStop", function()
|
button:SetScript("OnMouseUp", function()
|
||||||
local parent = this:GetParent()
|
if arg1 == "LeftButton" then
|
||||||
if parent.isMoving then
|
local parent = this:GetParent()
|
||||||
parent:StopMovingOrSizing()
|
if parent.isMoving then
|
||||||
parent.isMoving = false
|
parent:StopMovingOrSizing()
|
||||||
local point, _, relativePoint, x, y = parent:GetPoint()
|
parent.isMoving = false
|
||||||
addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y})
|
local point, _, relativePoint, x, y = parent:GetPoint()
|
||||||
|
addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -534,6 +540,10 @@ function QuestItemBar:UpdateFlyout(parent)
|
|||||||
btn = CreateFrame("Button", "Guda_QuestItemFlyoutButton" .. i, flyoutFrame, "Guda_ItemButtonTemplate")
|
btn = CreateFrame("Button", "Guda_QuestItemFlyoutButton" .. i, flyoutFrame, "Guda_ItemButtonTemplate")
|
||||||
table.insert(flyoutButtons, btn)
|
table.insert(flyoutButtons, btn)
|
||||||
|
|
||||||
|
btn:SetScript("OnDragStart", function() end)
|
||||||
|
btn:SetScript("OnReceiveDrag", function() end)
|
||||||
|
btn:SetScript("OnMouseDown", function() end)
|
||||||
|
|
||||||
btn:SetScript("OnEnter", function()
|
btn:SetScript("OnEnter", function()
|
||||||
Guda_ItemButton_OnEnter(this)
|
Guda_ItemButton_OnEnter(this)
|
||||||
if flyoutFrame then flyoutFrame.hideTime = GetTime() + 5 end -- Keep open
|
if flyoutFrame then flyoutFrame.hideTime = GetTime() + 5 end -- Keep open
|
||||||
@@ -637,13 +647,19 @@ function QuestItemBar:Initialize()
|
|||||||
|
|
||||||
-- Handle dragging
|
-- Handle dragging
|
||||||
frame:RegisterForDrag("LeftButton")
|
frame:RegisterForDrag("LeftButton")
|
||||||
frame:SetScript("OnDragStart", function()
|
frame:SetScript("OnMouseDown", function()
|
||||||
this:StartMoving()
|
if arg1 == "LeftButton" then
|
||||||
|
this:StartMoving()
|
||||||
|
this.isMoving = true
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
frame:SetScript("OnDragStop", function()
|
frame:SetScript("OnMouseUp", function()
|
||||||
this:StopMovingOrSizing()
|
if arg1 == "LeftButton" and this.isMoving then
|
||||||
local point, _, relativePoint, x, y = this:GetPoint()
|
this:StopMovingOrSizing()
|
||||||
addon.Modules.DB:SetSetting("questBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y})
|
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)
|
end)
|
||||||
|
|
||||||
-- Restore position
|
-- Restore position
|
||||||
|
|||||||
+29
-17
@@ -87,19 +87,25 @@ function TrackedItemBar:Update()
|
|||||||
table.insert(buttons, button)
|
table.insert(buttons, button)
|
||||||
|
|
||||||
button:RegisterForDrag("LeftButton")
|
button:RegisterForDrag("LeftButton")
|
||||||
button:SetScript("OnDragStart", function()
|
button:SetScript("OnDragStart", function() end)
|
||||||
if IsShiftKeyDown() then
|
button:SetScript("OnReceiveDrag", function() end)
|
||||||
this:GetParent():StartMoving()
|
button:SetScript("OnMouseDown", function()
|
||||||
this:GetParent().isMoving = true
|
if arg1 == "LeftButton" then
|
||||||
|
if IsShiftKeyDown() then
|
||||||
|
this:GetParent():StartMoving()
|
||||||
|
this:GetParent().isMoving = true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
button:SetScript("OnDragStop", function()
|
button:SetScript("OnMouseUp", function()
|
||||||
local parent = this:GetParent()
|
if arg1 == "LeftButton" then
|
||||||
if parent.isMoving then
|
local parent = this:GetParent()
|
||||||
parent:StopMovingOrSizing()
|
if parent.isMoving then
|
||||||
parent.isMoving = false
|
parent:StopMovingOrSizing()
|
||||||
local point, _, relativePoint, x, y = parent:GetPoint()
|
parent.isMoving = false
|
||||||
addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y})
|
local point, _, relativePoint, x, y = parent:GetPoint()
|
||||||
|
addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -173,13 +179,19 @@ function TrackedItemBar:Initialize()
|
|||||||
|
|
||||||
-- Handle dragging
|
-- Handle dragging
|
||||||
frame:RegisterForDrag("LeftButton")
|
frame:RegisterForDrag("LeftButton")
|
||||||
frame:SetScript("OnDragStart", function()
|
frame:SetScript("OnMouseDown", function()
|
||||||
this:StartMoving()
|
if arg1 == "LeftButton" then
|
||||||
|
this:StartMoving()
|
||||||
|
this.isMoving = true
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
frame:SetScript("OnDragStop", function()
|
frame:SetScript("OnMouseUp", function()
|
||||||
this:StopMovingOrSizing()
|
if arg1 == "LeftButton" and this.isMoving then
|
||||||
local point, _, relativePoint, x, y = this:GetPoint()
|
this:StopMovingOrSizing()
|
||||||
addon.Modules.DB:SetSetting("trackedBarPosition", {point = point, relativePoint = relativePoint, x = x, y = y})
|
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)
|
end)
|
||||||
|
|
||||||
-- Restore position
|
-- Restore position
|
||||||
|
|||||||
Reference in New Issue
Block a user