Drag Handler Questions

I was wondering how to approach a couple of things:

1. Say you open an inventory, start a drag, then hit a button that closes the panel without finishing the drag. I think because the drag handler is on that panel that was disabled, the dragged item just gets stuck on the screen for me. Is there any remedy to this? I was considering making a custom ItemViewSlotDragHandler that cancels the drag in an OnDisable function?

2. If you start a drag, then start using your keyboard to navigate the UI, it looks like the dragged item is going to be dropped into a slot selected by the keyboard. But because it was started with the mouse it will always drop onto the slot where the mouse is hovering over. Is there a way of making it so the drop handler drops it onto the selected slot if one has been chosen by keyboard inputs? I am using rewired if this changes the answer.

Thanks so much!
Andrew
 
Those are two good questions... I'll see what I can do to fix both of them, since I'm sure this is an issue that isn't particular to only your setup.
I'll let you know as soon as I have tested this and if I find a solution
 
I fixed the first bug and added an option to choose whether theitem should be dropped on the last selected slot (including with keyboard) or if it should be dropped where the mouse dropped the item.

1) I added an event for when the container is disabled which cancels the drag event. it required some changed in the container, cursor manager and drag handler
2) I added an option "m_DropOnLastSelectedView" in the ItemViewDropHandler which makes the drop event use data from the last selection instead of the data from the drop event.

Both required a few small changes but in a lot of scripts. So I would recommend you wait for the next update. It should be sometime this week. I'll let people know in the doscord channel when it is released.

If you want to be able to only use the keyboard instead of using the mouse for drag and drop you can have a look at the MoveItemAction. The video tutorial on Move Items showcases that quite well:
There is also the "Open Other Item View Slot Container Item Action" which allows you to do something similar to Move but in another ItemViewSlotContainer than the the source container.
 
Top