mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-11 16:44:48 -07:00
fixed multi-card dragging
This commit is contained in:
parent
aa9ebd3179
commit
5fa009714b
3 changed files with 23 additions and 18 deletions
|
|
@ -7,9 +7,10 @@
|
|||
CardDragItem::CardDragItem(CardItem *_item, int _id, const QPointF &_hotSpot, bool _faceDown, CardDragItem *parentDrag)
|
||||
: QGraphicsItem(), id(_id), item(_item), hotSpot(_hotSpot), faceDown(_faceDown), currentZone(0)
|
||||
{
|
||||
if (parentDrag)
|
||||
if (parentDrag) {
|
||||
parentDrag->addChildDrag(this);
|
||||
else {
|
||||
setZValue(1000000000 + hotSpot.x() * 1000000 + hotSpot.y() * 1000 + 1000);
|
||||
} else {
|
||||
if ((hotSpot.x() < 0) || (hotSpot.y() < 0)) {
|
||||
qDebug(QString("CardDragItem: coordinate overflow: x = %1, y = %2").arg(hotSpot.x()).arg(hotSpot.y()).toLatin1());
|
||||
hotSpot = QPointF();
|
||||
|
|
@ -18,11 +19,11 @@ CardDragItem::CardDragItem(CardItem *_item, int _id, const QPointF &_hotSpot, bo
|
|||
hotSpot = QPointF(CARD_WIDTH, CARD_HEIGHT);
|
||||
}
|
||||
setCursor(Qt::ClosedHandCursor);
|
||||
setZValue(1000000000);
|
||||
}
|
||||
if (item->getTapped())
|
||||
setTransform(QTransform().translate((float) CARD_WIDTH / 2, (float) CARD_HEIGHT / 2).rotate(90).translate((float) -CARD_WIDTH / 2, (float) -CARD_HEIGHT / 2));
|
||||
|
||||
setZValue(2000000000);
|
||||
setCacheMode(DeviceCoordinateCache);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue