Also update the currentZone

This commit is contained in:
Basile Clément 2025-05-02 10:02:04 +02:00
parent a8074ba1f2
commit 488e0a3f54
No known key found for this signature in database

View file

@ -47,8 +47,13 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
cursorZone = zoneViewZone; cursorZone = zoneViewZone;
else if (cardZone) else if (cardZone)
cursorZone = cardZone; cursorZone = cardZone;
// Always update the current zone, even if its null, to cancel the drag
// instead of dropping cards into an non-intuitive location.
currentZone = cursorZone;
if (!cursorZone) { if (!cursorZone) {
// Temporary fix: avoid the cards getting stuck visually when not over // Avoid the cards getting stuck visually when not over
// any zone. // any zone.
QPointF newPos = cursorScenePos - hotSpot; QPointF newPos = cursorScenePos - hotSpot;
@ -60,7 +65,6 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
return; return;
} }
currentZone = cursorZone;
QPointF zonePos = currentZone->scenePos(); QPointF zonePos = currentZone->scenePos();
QPointF cursorPosInZone = cursorScenePos - zonePos; QPointF cursorPosInZone = cursorScenePos - zonePos;