mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
Fix spellbook drag-drop onto action bar by detecting mouse release over slot
This commit is contained in:
parent
2fae698f48
commit
d4d5a22685
1 changed files with 10 additions and 7 deletions
|
|
@ -1510,17 +1510,20 @@ void GameScreen::renderActionBar(game::GameHandler& gameHandler) {
|
|||
}
|
||||
|
||||
bool rightClicked = ImGui::IsItemClicked(ImGuiMouseButton_Right);
|
||||
bool hoveredOnRelease = ImGui::IsItemHovered() &&
|
||||
ImGui::IsMouseReleased(ImGuiMouseButton_Left);
|
||||
|
||||
// Drop held item from inventory onto action bar
|
||||
if (clicked && inventoryScreen.isHoldingItem()) {
|
||||
const auto& held = inventoryScreen.getHeldItem();
|
||||
gameHandler.setActionBarSlot(i, game::ActionBarSlot::ITEM, held.itemId);
|
||||
inventoryScreen.returnHeldItem(gameHandler.getInventory());
|
||||
} else if (clicked && spellbookScreen.isDraggingSpell()) {
|
||||
// Drop dragged spell from spellbook onto this slot
|
||||
// Drop dragged spell from spellbook onto this slot
|
||||
// (mouse release over slot — button click won't fire since press was in spellbook)
|
||||
if (hoveredOnRelease && spellbookScreen.isDraggingSpell()) {
|
||||
gameHandler.setActionBarSlot(i, game::ActionBarSlot::SPELL,
|
||||
spellbookScreen.getDragSpellId());
|
||||
spellbookScreen.consumeDragSpell();
|
||||
} else if (clicked && inventoryScreen.isHoldingItem()) {
|
||||
// Drop held item from inventory onto action bar
|
||||
const auto& held = inventoryScreen.getHeldItem();
|
||||
gameHandler.setActionBarSlot(i, game::ActionBarSlot::ITEM, held.itemId);
|
||||
inventoryScreen.returnHeldItem(gameHandler.getInventory());
|
||||
} else if (clicked && actionBarDragSlot_ >= 0) {
|
||||
// Dropping a dragged action bar slot onto another slot - swap or place
|
||||
if (i != actionBarDragSlot_) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue