Commit ca3a7e69 authored by Max-Wilhelm Bruker's avatar Max-Wilhelm Bruker
Browse files

stop card tap/untap animation in CardItem::resetState() to avoid unfinished...

stop card tap/untap animation in CardItem::resetState() to avoid unfinished animation during zone change
parent eb6520a7
......@@ -2,8 +2,8 @@
#include <QPainter>
#include <QMenu>
#include <QAction>
#include <QGraphicsScene>
#include <QGraphicsSceneMouseEvent>
#include "gamescene.h"
#include "carditem.h"
#include "carddragitem.h"
#include "carddatabase.h"
......@@ -369,6 +369,8 @@ void CardItem::resetState()
attachedCards.clear();
setTapped(false, false);
setDoesntUntap(false);
if (scene())
static_cast<GameScene *>(scene())->unregisterAnimationItem(this);
update();
}
......
......@@ -262,6 +262,13 @@ void GameScene::registerAnimationItem(AbstractCardItem *card)
animationTimer->start(50, this);
}
void GameScene::unregisterAnimationItem(AbstractCardItem *card)
{
cardsToAnimate.remove(static_cast<CardItem *>(card));
if (cardsToAnimate.isEmpty())
animationTimer->stop();
}
void GameScene::startRubberBand(const QPointF &selectionOrigin)
{
emit sigStartRubberBand(selectionOrigin);
......
......@@ -42,6 +42,7 @@ public:
void stopRubberBand();
void registerAnimationItem(AbstractCardItem *item);
void unregisterAnimationItem(AbstractCardItem *card);
public slots:
void toggleZoneView(Player *player, const QString &zoneName, int numberCards);
void addRevealedZoneView(Player *player, CardZone *zone, const QList<ServerInfo_Card *> &cardList);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment