mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix selecting and remove amount text when dragging
This commit is contained in:
parent
c1c09dce1b
commit
f52d66d721
@ -246,5 +246,5 @@ pub fn unequip(slot: EquipSlot, inventory: &mut Inventory, loadout: &mut Loadout
|
|||||||
loadout_remove(slot, loadout) // Remove item from loadout
|
loadout_remove(slot, loadout) // Remove item from loadout
|
||||||
.and_then(|i| inventory.push(i)) // Insert into inventory
|
.and_then(|i| inventory.push(i)) // Insert into inventory
|
||||||
.and_then(|i| loadout_insert(slot, i, loadout)) // If that fails put back in loadout
|
.and_then(|i| loadout_insert(slot, i, loadout)) // If that fails put back in loadout
|
||||||
.unwrap(); // Never fails
|
.unwrap_none(); // Never fails
|
||||||
}
|
}
|
||||||
|
@ -255,11 +255,10 @@ where
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not dragging and the mouse is down and started on this slot start dragging
|
// If not dragging and there is a drag event on this slot start dragging
|
||||||
let input = &ui.global_input().current;
|
if ui.widget_input(widget).drags().left().next().is_some() {
|
||||||
if let mouse::ButtonPosition::Down(_, Some(id)) = input.mouse.buttons.left() {
|
|
||||||
match self.state {
|
match self.state {
|
||||||
ManagerState::Selected(_, _) | ManagerState::Idle if widget == *id => {
|
ManagerState::Selected(_, _) | ManagerState::Idle => {
|
||||||
// Start dragging if widget is filled
|
// Start dragging if widget is filled
|
||||||
if let Some(img) = content_img {
|
if let Some(img) = content_img {
|
||||||
self.state = ManagerState::Dragging(widget, slot, img);
|
self.state = ManagerState::Dragging(widget, slot, img);
|
||||||
@ -459,7 +458,11 @@ where
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Get amount (None => no amount text)
|
// Get amount (None => no amount text)
|
||||||
let amount = slot_key.amount(content_source);
|
let amount = if let Interaction::Dragging = interaction {
|
||||||
|
None // Don't show amount if being dragged
|
||||||
|
} else {
|
||||||
|
slot_key.amount(content_source)
|
||||||
|
};
|
||||||
|
|
||||||
// Get slot widget dimensions and position
|
// Get slot widget dimensions and position
|
||||||
let (x, y, w, h) = rect.x_y_w_h();
|
let (x, y, w, h) = rect.x_y_w_h();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user