From 488e0a3f54b73fb703cef8e5ea853a630841e1c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Basile=20Cl=C3=A9ment?= Date: Fri, 2 May 2025 10:02:04 +0200 Subject: [PATCH] Also update the currentZone --- cockatrice/src/game/board/card_drag_item.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cockatrice/src/game/board/card_drag_item.cpp b/cockatrice/src/game/board/card_drag_item.cpp index 298c5f59e..ab4431958 100644 --- a/cockatrice/src/game/board/card_drag_item.cpp +++ b/cockatrice/src/game/board/card_drag_item.cpp @@ -47,8 +47,13 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos) cursorZone = zoneViewZone; else if (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) { - // Temporary fix: avoid the cards getting stuck visually when not over + // Avoid the cards getting stuck visually when not over // any zone. QPointF newPos = cursorScenePos - hotSpot; @@ -60,7 +65,6 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos) return; } - currentZone = cursorZone; QPointF zonePos = currentZone->scenePos(); QPointF cursorPosInZone = cursorScenePos - zonePos;