From f70e87c5a0ceae163441a94f8a4293bf1caf0681 Mon Sep 17 00:00:00 2001 From: ctrlaltca Date: Tue, 19 Jun 2018 22:55:01 +0200 Subject: [PATCH] Fix #3285 (#3299) --- cockatrice/src/carditem.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/carditem.cpp b/cockatrice/src/carditem.cpp index 1c17d510..69f57b74 100644 --- a/cockatrice/src/carditem.cpp +++ b/cockatrice/src/carditem.cpp @@ -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)