Today, I implemented, what I think, is a useful feature into Flare.
Previously, there were instances where the player could pick up just one item in an inventory stack (like when shift-clicking). In fact, all item movement on touchscreen/mouse-less devices was done that way. This was unacceptable for large stacks, such as those for Gold. My solution was to create a dialog menu to let the player decide how much they want to pick up.
The implementation of this was a bit tricky. Flare's drag-and-drop system worked under the assumption that it was literally that: DRAG and drop. Clicking on items immediately removed them from their source slot, and there was no way to maintain what was being dragged if the player let off the mouse button. So as a result, I needed to make sure:
- The stack isn't picked up when shift-clicking on an item stack
- The item stack and source id are still stored in our dragging variables, but not displayed visually
- When the player clicks "OK" on the dialog box, the desired quantity is removed from the source slot
I'm satisfied with the end result, although the dialog menu itself may get some usability tweaks. For example, the text field with the value could be editable by keyboard. Also, the rate at which the arrows increment/decrement the value might need some adjusting.