This commit is contained in:
ctrlaltca
2018-06-19 22:55:01 +02:00
committed by GitHub
parent 0b3e86e307
commit f70e87c5a0
+10 -3
View File
@@ -402,10 +402,19 @@ void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
bool CardItem::animationEvent()
{
int rotation = ROTATION_DEGREES_PER_FRAME;
bool animationIncomplete = true;
if (!tapped)
rotation *= -1;
tapAngle += rotation;
if (tapped && (tapAngle > 90)) {
tapAngle = 90;
animationIncomplete = false;
}
if (!tapped && (tapAngle < 0)) {
tapAngle = 0;
animationIncomplete = false;
}
setTransform(QTransform()
.translate(CARD_WIDTH_HALF, CARD_HEIGHT_HALF)
@@ -414,9 +423,7 @@ bool CardItem::animationEvent()
setHovered(false);
update();
if ((tapped && (tapAngle >= 90)) || (!tapped && (tapAngle <= 0)))
return false;
return true;
return animationIncomplete;
}
QVariant CardItem::itemChange(GraphicsItemChange change, const QVariant &value)