This commit is contained in:
ctrlaltca 2018-06-19 22:55:01 +02:00 committed by GitHub
parent 0b3e86e307
commit f70e87c5a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -402,10 +402,19 @@ void CardItem::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
bool CardItem::animationEvent() bool CardItem::animationEvent()
{ {
int rotation = ROTATION_DEGREES_PER_FRAME; int rotation = ROTATION_DEGREES_PER_FRAME;
bool animationIncomplete = true;
if (!tapped) if (!tapped)
rotation *= -1; rotation *= -1;
tapAngle += rotation; tapAngle += rotation;
if (tapped && (tapAngle > 90)) {
tapAngle = 90;
animationIncomplete = false;
}
if (!tapped && (tapAngle < 0)) {
tapAngle = 0;
animationIncomplete = false;
}
setTransform(QTransform() setTransform(QTransform()
.translate(CARD_WIDTH_HALF, CARD_HEIGHT_HALF) .translate(CARD_WIDTH_HALF, CARD_HEIGHT_HALF)
@ -414,9 +423,7 @@ bool CardItem::animationEvent()
setHovered(false); setHovered(false);
update(); update();
if ((tapped && (tapAngle >= 90)) || (!tapped && (tapAngle <= 0))) return animationIncomplete;
return false;
return true;
} }
QVariant CardItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant CardItem::itemChange(GraphicsItemChange change, const QVariant &value)