Skip to content

Commit

Permalink
fix cursor alignment following gamepad movement in stash
Browse files Browse the repository at this point in the history
align the cursor to the middle of the cell/region when moving through the stash to match the way we simulate mouse movement for inventory cells
  • Loading branch information
ephphatha authored and AJenbo committed Sep 1, 2023
1 parent 52b806c commit c85fcbd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Source/controls/plrctrls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1167,9 +1167,9 @@ void StashMove(AxisDirection dir)

if (ActiveStashSlot != InvalidStashPoint) {
Point mousePos = GetStashSlotCoord(ActiveStashSlot);
if (pcurs == CURSOR_HAND) {
mousePos += Displacement { INV_SLOT_HALF_SIZE_PX, INV_SLOT_HALF_SIZE_PX };
}
// Stash coordinates are all the top left of the cell, so we need to shift the mouse to the center of the held item
// or the center of the cell if we have a hand cursor (itemSize will be 1x1 here so we can use the same calculation)
mousePos += Displacement { itemSize.width * INV_SLOT_HALF_SIZE_PX, itemSize.height * INV_SLOT_HALF_SIZE_PX };
SetCursorPos(mousePos);
return;
}
Expand Down

0 comments on commit c85fcbd

Please sign in to comment.