Skip to content

Commit 63ffb04

Browse files
committed
cleanup drag and drop handle drop
1 parent c761987 commit 63ffb04

File tree

5 files changed

+11
-36
lines changed

5 files changed

+11
-36
lines changed

Intersect.Client.Core/Interface/Game/Bag/BagItem.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private void Icon_Clicked(Base sender, MouseButtonState arguments)
145145

146146
private void Icon_DoubleClicked(Base sender, MouseButtonState arguments)
147147
{
148-
if (Globals.InBag)
148+
if (arguments.MouseButton is MouseButton.Left)
149149
{
150150
Globals.Me?.TryRetrieveItemFromBag(SlotIndex, -1);
151151
}
@@ -157,7 +157,7 @@ private void Icon_DoubleClicked(Base sender, MouseButtonState arguments)
157157

158158
public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
159159
{
160-
var targetNode = Interface.FindComponentUnderCursor(NodeFilter.None);
160+
var targetNode = Interface.FindComponentUnderCursor();
161161

162162
// Find the first parent acceptable in that tree that can accept the package
163163
while (targetNode != default)
@@ -176,14 +176,9 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
176176
targetNode = targetNode.Parent;
177177
break;
178178
}
179-
180-
// If we've reached the top of the tree, we can't drop here, so cancel drop
181-
if (targetNode == null)
182-
{
183-
return false;
184-
}
185179
}
186180

181+
// If we've reached the top of the tree, we can't drop here, so cancel drop
187182
return false;
188183
}
189184

Intersect.Client.Core/Interface/Game/Bank/BankItem.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ private void Icon_DoubleClicked(Base sender, MouseButtonState arguments)
183183

184184
public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
185185
{
186-
var targetNode = Interface.FindComponentUnderCursor(NodeFilter.None);
186+
var targetNode = Interface.FindComponentUnderCursor();
187187

188188
// Find the first parent acceptable in that tree that can accept the package
189189
while (targetNode != default)
@@ -241,14 +241,9 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
241241
targetNode = targetNode.Parent;
242242
break;
243243
}
244-
245-
// If we've reached the top of the tree, we can't drop here, so cancel drop
246-
if (targetNode == null)
247-
{
248-
return false;
249-
}
250244
}
251245

246+
// If we've reached the top of the tree, we can't drop here, so cancel drop
252247
return false;
253248
}
254249

Intersect.Client.Core/Interface/Game/Hotbar/HotbarItem.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ private void Icon_HoverEnter(Base sender, EventArgs arguments)
222222

223223
public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
224224
{
225-
var targetNode = Interface.FindComponentUnderCursor(NodeFilter.None);
225+
var targetNode = Interface.FindComponentUnderCursor();
226226

227227
// Find the first parent acceptable in that tree that can accept the package
228228
while (targetNode != default)
@@ -236,14 +236,9 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
236236
{
237237
targetNode = targetNode.Parent;
238238
}
239-
240-
// If we've reached the top of the tree, we can't drop here, so cancel drop
241-
if (targetNode == null)
242-
{
243-
return false;
244-
}
245239
}
246240

241+
// If we've reached the top of the tree, we can't drop here, so cancel drop
247242
return false;
248243
}
249244

Intersect.Client.Core/Interface/Game/Inventory/InventoryItem.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
420420
return true;
421421
}
422422

423-
var targetNode = Interface.FindComponentUnderCursor(NodeFilter.None);
423+
var targetNode = Interface.FindComponentUnderCursor();
424424

425425
// Find the first parent acceptable in that tree that can accept the package
426426
while (targetNode != default)
@@ -461,14 +461,9 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
461461
targetNode = targetNode.Parent;
462462
break;
463463
}
464-
465-
// If we've reached the top of the tree, we can't drop here, so return false
466-
if (targetNode == null)
467-
{
468-
return false;
469-
}
470464
}
471465

466+
// If we've reached the top of the tree, we can't drop here, so cancel drop
472467
return false;
473468
}
474469

Intersect.Client.Core/Interface/Game/Spells/SpellItem.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void Icon_DoubleClicked(Base sender, MouseButtonState arguments)
161161

162162
public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
163163
{
164-
var targetNode = Interface.FindComponentUnderCursor(NodeFilter.None);
164+
var targetNode = Interface.FindComponentUnderCursor();
165165

166166
// Find the first parent acceptable in that tree that can accept the package
167167
while (targetNode != default)
@@ -180,14 +180,9 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
180180
targetNode = targetNode.Parent;
181181
break;
182182
}
183-
184-
// If we've reached the top of the tree, we can't drop here, so cancel drop
185-
if (targetNode == null)
186-
{
187-
return false;
188-
}
189183
}
190184

185+
// If we've reached the top of the tree, we can't drop here, so cancel drop
191186
return false;
192187
}
193188

0 commit comments

Comments
 (0)