fix: Prevent dragged cards getting stuck

Update the position of the card even if it is not above any zone.
This commit is contained in:
Basile Clément 2025-05-01 21:22:20 +02:00
parent 77d13090b5
commit a8074ba1f2
No known key found for this signature in database

View file

@ -47,8 +47,19 @@ void CardDragItem::updatePosition(const QPointF &cursorScenePos)
cursorZone = zoneViewZone;
else if (cardZone)
cursorZone = cardZone;
if (!cursorZone)
if (!cursorZone) {
// Temporary fix: avoid the cards getting stuck visually when not over
// any zone.
QPointF newPos = cursorScenePos - hotSpot;
if (newPos != pos()) {
for (int i = 0; i < childDrags.size(); i++)
childDrags[i]->setPos(newPos + childDrags[i]->getHotSpot());
setPos(newPos);
}
return;
}
currentZone = cursorZone;
QPointF zonePos = currentZone->scenePos();