mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 22:42:14 -07:00
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:
parent
77d13090b5
commit
a8074ba1f2
1 changed files with 12 additions and 1 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue