kelp icon indicating copy to clipboard operation
kelp copied to clipboard

[feature]: Drag and Drop for inventories

Open DSeeLP opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe With the current implementation its hard to build things that use drag and drop like a filebrowser. Because you have to manually save the last clicked itemstack.

Describe the solution you'd like Add a method to get the last itemstack that was on the cursor.

DSeeLP avatar May 27 '21 13:05 DSeeLP

Could you please provide some more detail? What would a proper drag-and-drop implementation look like for you?

PXAV avatar May 27 '21 13:05 PXAV

In the KelpClickEvent you can provide a DragAndDrop object which contains an action (drag or drop), the KelpItem which can be null and if dropped the target KelpItem which is simply the item clicked. This should be included so you only need to pass the DragAndDrop object to a method

DSeeLP avatar May 28 '21 07:05 DSeeLP

The only downside of something like this is you need to cache on every InventoryClickEvent the content of the cursor

DSeeLP avatar May 28 '21 07:05 DSeeLP