From 1660c3e0a5884fe6956eeda8a26206cfe879a3fc Mon Sep 17 00:00:00 2001 From: vaisest <4550061+vaisest@users.noreply.github.com> Date: Thu, 3 Sep 2026 20:32:12 +0300 Subject: [PATCH] Fix double clicking and dragging items causing issues - #10149 --- src/Classes/ItemDBControl.lua | 6 +++++- src/Classes/ItemListControl.lua | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Classes/ItemDBControl.lua b/src/Classes/ItemDBControl.lua index fbb004f766..1bf81df5eb 100644 --- a/src/Classes/ItemDBControl.lua +++ b/src/Classes/ItemDBControl.lua @@ -324,7 +324,7 @@ function ItemDBClass:Draw(viewPort) end function ItemDBClass:GetRowValue(column, index, item) - if column == 1 then + if item and column == 1 then return colorCodes[item.rarity] .. item.name end end @@ -371,6 +371,10 @@ function ItemDBClass:OnSelClick(index, item, doubleClick) self.itemsTab:AddUndoState() self.itemsTab.build.buildFlag = true elseif doubleClick then + -- disallow dragging after double click since the window can jump when + -- the display item tooltip is created, which might cause the drag item + -- to get stuck to the cursor + self.selDragging = false self.itemsTab:CreateDisplayItemFromRaw(item.raw, true) return false end diff --git a/src/Classes/ItemListControl.lua b/src/Classes/ItemListControl.lua index 9cd48b1957..f5dff08b8c 100644 --- a/src/Classes/ItemListControl.lua +++ b/src/Classes/ItemListControl.lua @@ -319,6 +319,9 @@ function ItemListClass:OnSelClick(index, itemId, doubleClick) self.itemsTab.build.buildFlag = true end elseif doubleClick then + -- disallow dragging since if the cursor is outside the selection after + -- the second click, the item will be stuck onto the cursor + self.selDragging = false local newItem = new("Item"):Item(item:BuildRaw()) newItem.id = item.id self.itemsTab:SetDisplayItem(newItem)