parent
0b3e86e307
commit
f70e87c5a0
1 changed files with 10 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue