Allow dropping items

Items can now be dropped by clicking to select the item then clicking
outside of the bag.
This commit is contained in:
Isaac Freund 2019-10-22 01:40:58 +02:00
parent baf04e75d9
commit 355c7666b9

View File

@ -248,6 +248,13 @@ impl<'a> Widget for Bag<'a> {
}
}
// Drop selected item
if let Some(to_drop) = state.selected_slot {
if ui.widget_input(ui.window).clicks().left().next().is_some() {
event = Some(Event::HudEvent(HudEvent::DropInventorySlot(to_drop)));
}
}
// Close button
if Button::image(self.imgs.close_button)
.w_h(28.0, 28.0)